Skip to content

Membership Plans setup

Rudkovskiy edited this page Jun 21, 2017 · 7 revisions

To access the NetLicensing Management Console you will need a NetLicensing vendor account. If you do not have one already, signup here or use demo:demo account for testing purposes.

After you've logged in to NetLicensing Management Console you'll need to create a Product, Product Module and License Template(-s).

Create product

Consider following product attributes:

  • Number will be used to identify product at LABS64_NETLICENSING_PRODUCT_NUMBER (see below)
  • Auto-create Licensee set to true
laravel-boilerplate-nlic-01-product

Create product module

Consider following product module attributes:

  • Number will be used to identify product module at LABS64_NETLICENSING_PRODUCT_MODULE_NUMBER (see below)
  • Product Number set to defined above product number
  • Licensing Model set to Subscription
laravel-boilerplate-nlic-02-productmodule

Create license template(-s)

Consider following license template attributes:

  • Product Module Number set to defined above product module number
  • License Type set to TimeVolume
  • Set Automatic and Hidden Template to true is you want to define default (auto-assigned licenses; e.g. 1 day)
laravel-boilerplate-nlic-03-license-template

Verify license templates

A defined set of available License Templates might be looking as follows:

  • 1 day (this will be assigned as a default license after Licensee creation)
  • 1 week
  • 1 month
  • 1 year
laravel-boilerplate-nlic-04-license-templates

Configure NetLicensing properties

Open and edit .env file. Provide NetLicensing connection parameters (e.g. Username, Password, APIKey, SecurityMode) as well as created Product and Product Module identifiers.

# Labs64 NetLicensing
LABS64_NETLICENSING_USERNAME=demo
LABS64_NETLICENSING_PASSWORD=demo
LABS64_NETLICENSING_APIKEY=
LABS64_NETLICENSING_SECURITY_MODE=BASIC_AUTH
LABS64_NETLICENSING_PRODUCT_NUMBER=LB-DEMO
LABS64_NETLICENSING_PRODUCT_MODULE_NUMBER=LB-SUBSCRIPTION-PLAN

Source code examples

To protect the pages, use middleware "protection: {product-module-number}, {failed-route-name}" where:

  • {product-module-number} - the product module number created at NetLicensing
  • {failed-route-name} - the name of the route to handle non-authorized access.
// Example
Route::get('foo-path', 'FooController@index')->middleware('protection:foo-product-module-number, boo.path.access_denied');
Route::get('boo-path/access-denied','FooController@accessDenied')->name('boo.path.access_denied');

To protect content of the page, use blade directive "protection".

// Example
@protection(foo-product-module-number-1)
    Access granted to foo-product-module-number-1
@elseifprotection(foo-product-module-number-2)
    Access granted to foo-product-module-number-2
@elseprotection
    Access denied
@endprotection