Tilmeld Server API
1.0.0
Nymph user and group management with access controls.
|
Static Public Member Functions | |
static | gatekeeper ($ability=null) |
Check to see if the current user has an ability. More... | |
static | configure ($config=[]) |
Apply configuration to Tilmeld. More... | |
static | addAccessControlSelectors (&$optionsAndSelectors) |
Add selectors to a list of options and selectors which will limit results to only entities the current user has access to. More... | |
static | checkPermissions (&$entity, $type=Tilmeld::READ_ACCESS, $user=null) |
Check an entity's permissions for a user. More... | |
static | fillSession ($user) |
Fill session user data. More... | |
static | clearSession () |
Clear session user data. More... | |
static | extractToken ($token) |
Validate and extract the user from a token. More... | |
static | authenticate () |
Check for a TILMELDAUTH cookie, and, if set, authenticate from it. More... | |
static | login ($user, $sendAuthHeader) |
Logs the given user into the system. More... | |
static | logout () |
Logs the current user out of the system. | |
static | groupSort (&$array, $property=null, $caseSensitive=false, $reverse=false) |
Sort an array of groups hierarchically. More... | |
Public Attributes | |
const | VERSION = '1.0.0' |
const | NO_ACCESS = 0 |
const | READ_ACCESS = 1 |
const | WRITE_ACCESS = 2 |
const | FULL_ACCESS = 4 |
Static Public Attributes | |
static | $config |
static | $currentUser = null |
Tilmeld main class.
Provides an Nymph based user and group manager.
Definition at line 17 of file Tilmeld.php.
|
static |
Add selectors to a list of options and selectors which will limit results to only entities the current user has access to.
array | &$optionsAndSelectors | The options and selectors of the query. |
Definition at line 96 of file Tilmeld.php.
|
static |
Check for a TILMELDAUTH cookie, and, if set, authenticate from it.
Definition at line 450 of file Tilmeld.php.
|
static |
Check an entity's permissions for a user.
This will check the AC (Access Control) properties of the entity. These include the following properties:
"acUser" refers to the entity's owner, "acGroup" refers to all users in the entity's group and all ancestor groups, and "acOther" refers to any user who doesn't fit these descriptions.
Each of these properties should be either NO_ACCESS, READ_ACCESS, WRITE_ACCESS, or FULL_ACCESS.
These properties defaults to:
"acRead", "acWrite", and "acFull" are arrays of users and/or groups that also have those permissions.
Only users with FULL_ACCESS have the ability to change any of the ac*, user, and group properties.
The following conditions will result in different checks, which determine whether the check passes:
object | &$entity | The entity to check. |
int | $type | The lowest level of permission to consider a pass. One of Tilmeld::READ_ACCESS, Tilmeld::WRITE_ACCESS, or Tilmeld::FULL_ACCESS. |
\Tilmeld\Entities\User | null | $user | The user to check permissions for. If null, uses the current user. If false, checks for public access. |
Definition at line 268 of file Tilmeld.php.
|
static |
Clear session user data.
Also sets the default timezone to the server default.
Definition at line 408 of file Tilmeld.php.
|
static |
Apply configuration to Tilmeld.
$config should be an associative array of Tilmeld configuration. Use the following form:
[ 'setup_url' => 'http://example.com/tilmeld/', 'create_admin' => false ]
array | $config | An associative array of Tilmeld's configuration. |
Definition at line 78 of file Tilmeld.php.
|
static |
Validate and extract the user from a token.
string | $token | The authentication token. |
Definition at line 425 of file Tilmeld.php.
|
static |
Fill session user data.
Also sets the default timezone to the user's timezone.
\Tilmeld\Entities\User | $user | The user. |
Definition at line 383 of file Tilmeld.php.
|
static |
Check to see if the current user has an ability.
If $ability is null, it will check to see if a user is currently logged in.
string | $ability | The ability. |
Definition at line 58 of file Tilmeld.php.
|
static |
Sort an array of groups hierarchically.
An additional property of the groups can be used to sort them under their parents.
array | &$array | The array of groups. |
string | null | $property | The name of the property to sort groups by. Null for no additional sorting. |
bool | $caseSensitive | Sort case sensitively. |
bool | $reverse | Reverse the sort order. |
Definition at line 562 of file Tilmeld.php.
|
static |
Logs the given user into the system.
\Tilmeld\Entities\User | $user | The user. |
bool | $alwaysSendAuthHeader | When true, a custom header with the auth token will be sent. |
Definition at line 513 of file Tilmeld.php.