member($group, $user = null)
The member method allows you to check if a user is member of a given group.
Static | No | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
パラメータ |
|
|||||||||
返り値 | boolean. true if the user is member of the group, or false if not. |
As said in the introduction of the Auth package, an authentication system comes with three different drivers, each dealing with a part of the system.
The SimpleAuth group driver stores it's group definitions in the simpleauth configuration file. It provides the logic for checking if a user is a member of a group, and for retrieving group information, or the roles defined to to a group.
The SimpleAuth group driver stores it's group definitions in the simpleauth configuration file. The groups are defined as a multi-dimensional array, which must have the following structure:
array(
<id> => array( // where <id> is a number that identifies the group
'name' => 'name-of-this-group', // the name that identifies this group, like 'Administrators' or 'Guests'
'roles' => array('role', 'otherrole'), // list of roles assigned to this group
),
),
The simpleauth config file supplied with the Auth package contains some examples that you can use.
The member method allows you to check if a user is member of a given group.
Static | No | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
パラメータ |
|
|||||||||
返り値 | boolean. true if the user is member of the group, or false if not. |
The get_name method allows you to fetch the name of a given group id.
Static | No | ||||||
---|---|---|---|---|---|---|---|
パラメータ |
|
||||||
返り値 | mixed. false if the group id does not exist, or the defined name of the group. |
If no group id is given, the name of the first defined group is returned.
The get_name method allows you to fetch the roles defined for a given group id.
Static | No | ||||||
---|---|---|---|---|---|---|---|
パラメータ |
|
||||||
返り値 | array. If the group id does not exist, an empty array is returned. If no group id is given, the roles of the first group are returned. |