UGRPM

مستخدم - وظيفة

بعد إنشاء وظائف يمكن منح وظائف لمستخدم أو عدة مستخدمين و عرض الوظائف التي يمتلكها مستخدم ما و اختبار إن كان مستخدم يمتلك صاحية وظيفة...
مثال:

$user1Id = 10;
$user2Id = 32

$role1 = // ...
$role2 = // ...

$roles = [$role10,$role20,$role30//,...];
// Add $role1 to the user1Id
$ugrpm->createUserRole($user1Id,$role1);

//Add $roles to the $user2Id
$ugrpm->createUserRoles($user2Id,$roles);

// Add The $role2 to array of users IDs
$ugrpm->createRoleUsers($role2,[19,$user2Id,9]);

// Remove $role2 from $user1Id
$ugrpm->removeUserRole($user1Id,$role2);

// Remove all $roles from the user whos id is 19
$ugrpm->removeUserRoles(19,$roles);

// Remove the users in the array from the $role2
$ugrpm->removeRoleUsers($role2,[22,$use1Id,199]);

// Check if $user1Id have the role $role2
$ugrpm->userHaveRole($user1Id,$role2);

// Get roles belongs to the user $user1Id, His groups'role not included
$ugrpm->getUserRoles($user1Id);

// Get All roles belongs to the user $user1Id and his groups'role
$ugrpm->getAllUserRoles($user2Id);

// Retrieve users who have the role $role1
$ugrpm->getRoleUsers($role1);