The parent class is waContact.
Methods
-
getByLogin
Returns a class instance by specified user login name.
-
getLogin
Returns user’s login name.
-
getGroupIds
Returns group_id values, relating to a user, from the access rights settings table.
-
getUsers
Returns the list of users.
-
getAllGroups
Returns the list of all user groups.
-
getGroups
Returns the list of groups in which a user is included.
-
getApps
Returns the list of apps to which a user has access.
-
revokeUser
Revokes all access rights from a user.
-
formatName
Returns the full name of a user according to the system-wide name display format.
public static function getByLogin ($login)
Returns a class instance by specified user login name.
Parameters
-
$login
User’s login name.
Example
$admin = waUser::getByLogin('admin');
public function getLogin()
Returns user’s login name.
Example
$user = new waUser($contact_id); $login = $user->getLogin();
public function getGroupIds()
Returns group_id values, relating to a user, from the access rights settings table wa_contact_rights, including value 0 corresponding to group “All contacts”.
Example
$user = new waUser($contact_id); $group_ids = $user->getGroupIds();
public static function getUsers ($app_id = null)
Returns the list of users, optionally limited to those having access to a specified app.
Parameters
-
$app_id
ID of the app to which returned users must have access.
Example
$all_users = waUser::getUsers();
$myapp_users = waUser::getUsers('my_app');
public static function getAllGroups()
Returns the list of all user groups as an array with group IDs as keys and group names as values.
Example
waUser::getAllGroups()
Result
[
5 => 'Support',
1 => 'Administrators',
4 => 'Accounting',
2 => 'Head office',
3 => 'Remote',
]
public function getGroups ($with_names = false)
Returns the list of groups in which a user is included.
Parameters
-
$with_names
Flag denoting the returned value’s format:
true: associative array of group names where group IDs are array keys,false: zero-based array of group IDs.
Example
(new waUser($contact_id))->getGroups()
Result
[
1
]
Example
(new waUser($contact_id))->getGroups(true)
Result
[
1 => 'Administrators',
]
public function getApps ($sorted = true)
Returns the list of apps to which a user has access.
Parameters
-
$sorted
Flag denoting whether apps must be returned in the same order in which their icons have been sorted by a user in the main Webasyst menu.
Example
(new waUser($contact_id))->getApps()
Result
[
'installer' => [
'id' => 'installer',
'name' => 'Installer',
'description' => 'Install new apps from the Webasyst Store',
'icon' => [
48 => 'wa-apps/installer/img/installer.svg',
24 => 'wa-apps/installer/img/installer.svg',
16 => 'wa-apps/installer/img/installer.svg',
],
'mobile' => false,
'version' => '2.7.2',
'critical' => '2.7.2',
'system' => true,
'vendor' => 'webasyst',
'csrf' => true,
'ui' => '1.3,2.0',
'build' => 732,
'img' => 'wa-apps/installer/img/installer.svg',
],
'site' => [
'id' => 'site',
'name' => 'Site',
'icon' => [
48 => 'wa-apps/site/img/site512.png',
24 => 'wa-apps/site/img/site512.png',
16 => 'wa-apps/site/img/site512.png',
],
'sash_color' => '#49a2e0',
'frontend' => true,
'version' => '2.5.31',
'critical' => '2.5.0',
'vendor' => 'webasyst',
'system' => true,
'rights' => true,
'plugins' => true,
'themes' => true,
'pages' => true,
'auth' => true,
'csrf' => true,
'my_account' => true,
'build' => 275,
'img' => 'wa-apps/site/img/site512.png',
'ui' => '1.3',
],
//...
]
public static function revokeUser ($id, $clear_login_password = true)
Revokes all access rights from a user.
Parameters
-
$id
User’s contact ID.
-
$clear_login_password
Flag denoting whether user’s login name and password must be cleared.
Example
waUser::revokeUser($contact_id, true);
public static function formatName ($user)
Returns the full name of a user according to the system-wide name display format.
Parameters
-
$user
Instance of the
waUserclass corresponding to the user whose name must be returned.
Example
echo waUser::formatName(new waUser($contact_id));
Result
John Fitzgerald Kennedy









