Skip to content

phuocdaivl/sts-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DaiDP STS SDK

User management and Brand tenant

Latest Version on Packagist Software License Build Status Total Downloads

Download & Install

composer require phuocdaivl/sts-sdk

Add service provider

Add the service provider to the providers array in the config/app.php config file as follows:

'providers' => [

    ...

    DaiDP\StsSDK\Providers\StsServiceProvider::class,
]

Well done.

User management

Basic use:

$umSDK = app()->get(\DaiDP\StsSDK\UserManagement\UserManagementInterface::class);

Methods

The following methods are available on the UserManagement instance.

register()

Create new account

$data = [
    'username' => '0766808284',
    'fullname' => 'Phước Đại',
    'email'    => '[email protected]',
    'password' => '12345678',
    'confirmpassword' => '12345678'
];
$result = $umSDK->register($data);

resetPassword()

Set new password for account

$phone    = '0766808284';
$password = 'abc123ABC';
$result   = $umSDK->resetPassword($phone, $password);

Tenant management

Basic use:

$tmSDK = app()->get(\DaiDP\StsSDK\TenantManagement\TenantManagementInterface::class);

Methods

The following methods are available on the TenantManagement instance.

createTenant()

Create new database tenant

$name = 'tenant001';
$result = $tmSDK->createTenant($name);

createConnectionString()

Create new database connection of tenant

$idTenant = 'f06e16bc-1035-4de3-93cc-96bdd21da4a5';
$connectionString = 'Server=localhost;port=3306;Database=tenant_01;user=root;password=';
$result = $tmSDK->createConnectionString($idTenant, $connectionString);

getConnectionStrings()

Get database connection string list

$serviceName = 'RetailProBrand';
$result = $tmSDK->getConnectionStrings($serviceName);

System user management

Basic use:

$sysuSDK = app()->get(\DaiDP\StsSDK\SystemUserManagement\SystemUserManagementInterface::class);

Methods

The following methods are available on the SystemUserManagement instance.

register()

Create new account

$data = [
    'email'    => '[email protected]',
    'fullname' => 'Phước Đại',
    'password' => '12345678',
    'confirmpassword' => '12345678'
];
$result = $sysuSDK->register($data);

resetPassword()

Set new password for account

$email    = '[email protected]';
$password = 'abc123ABC';
$result   = $sysuSDK->resetPassword($email, $password);

changePassword()

Change account password

$email       = '[email protected]';
$oldPassword = '12345678';
$newPassword = 'abc123ABC';
$result      = $sysuSDK->changePassword($email, $oldPassword, $newPassword);

Tenant user management

Basic use:

$tumSDK = app()->get(\DaiDP\StsSDK\TenantUserManagement\TenantUserManagementInterface::class);
$tumSDK->setTenantId('f06e16bc-1035-4de3-93cc-96bdd21da4a5'); // required

Methods

The following methods are available on the TenantUserManagement instance.

register()

Create new account

$data = [
    'username' => 'usertn001',
    'email'    => '[email protected]',
    'fullname' => 'Phước Đại',
    'password' => '12345678',
    'confirmpassword' => '12345678'
];
$result = $tumSDK->register($data);

resetPassword()

Set new password for account

$username = 'usertn001';
$password = 'abc123ABC';
$result   = $tumSDK->resetPassword($username, $password);

changePassword()

Change account password

$username    = 'usertn001';
$oldPassword = '12345678';
$newPassword = 'abc123ABC';
$result      = $tumSDK->changePassword($username, $oldPassword, $newPassword);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages