UserManagement __construct(
)
|
|
Class constructor. Nothing special to be done when constructing.
API Tags:
boolean addAdminToIdp(
IdP
$idp, string
$user
)
|
|
Adds a new administrator to an existing IdP
Parameters:
IdP |
$idp: |
institution to which the admin is to be added. |
string |
$user: |
persistent user ID that is to be added as an admin. |
API Tags:
Return: | This function always returns TRUE. |
Access: | public |
string checkTokenValidity(
string
$token
)
|
|
Checks if a given invitation token exists and is valid in the invitations database returns a string with the following values:
OK-NEW valid token exists, and is not attached to an existing institution. When consuming the token, a new inst will be created OK-EXISTING valid token exists, and is attached to an existing institution. When consuming the token, user will be added as an admin FAIL-NONEXISTINGTOKEN this token does not exist at all in the database FAIL-ALREADYCONSUMED the token exists, but has been used before FAIL-EXPIRED the token exists, but has expired
Parameters:
API Tags:
IdP createIdPFromToken(
string
$token, string
$owner
)
|
|
This function creates a new IdP in the database based on a valid invitation token - or adds a new administrator to an existing one. The institution is created for the logged-in user (second argument) who presents the token (first argument). The tokens are created via createToken().
Parameters:
string |
$token: |
The invitation token (must exist in the database and be valid). |
string |
$owner: |
Persistent User ID who becomes the administrator of the institution |
API Tags:
mixed createToken(
boolean
$by_fedadmin, type
$for,
$inst_identifier, [string
$external_id = 0], [type
$country = 0], mixed
$inst
)
|
|
Creates a new invitation token. The token's main purpose is to be sent out by mail. The function either can generate a token for a new administrator of an existing institution, or for a new institution. In the latter case, the institution only actually gets created in the DB if the token is actually consumed via createIdPFromToken().
Parameters:
boolean |
$by_fedadmin: |
is the invitation token created for a federation admin or from an existing inst admin |
type |
$for: |
identifier (typically email address) for which the invitation is created |
mixed |
$inst: |
either an instance of the IdP class (for existing institutions to invite new admins) or a string (new institution - this is the inst name then) |
string |
$external_id: |
if the IdP to be created is related to an external DB entity, this parameter contains that ID |
type |
$country: |
if the institution is new (i.e. $inst is a string) this parameter needs to specify the federation of the new inst |
|
$inst_identifier: |
|
API Tags:
Return: | The function returns either the token (as string) or FALSE if something went wrong |
Access: | public |
boolean invalidateToken(
string
$token
)
|
|
Invalidates a token so that it can't be used any more. Tokens automatically expire after 24h, but can be invalidated earlier, e.g. after having been used to create an institution. If the token doesn't exist in the DB or is already invalidated, nothing happens.
Parameters:
string |
$token: |
the token to invalidate |
API Tags:
Return: | This function always returns TRUE. |
Access: | public |
array listInstitutionsByAdmin(
string
$userid
)
|
|
For a given persistent user identifier, returns an array of institution identifiers (not the actual objects!) for which this user is the/a administrator.
Parameters:
string |
$userid: |
persistent user identifier |
API Tags:
Return: | array of institution IDs |
Access: | public |
if listPendingInvitations(
[type
$idp_identifier = 0]
)
|
|
Retrieves all pending invitations for an institution or for a federation.
Parameters:
type |
$idp_identifier: |
the identifier of the institution. If not set, returns invitations for not-yet-created insts |
API Tags:
Return: | idp_identifier is set: an array of strings (mail addresses); otherwise an array of tuples (country;name;mail) |
Access: | public |
boolean removeAdminFromIdP(
IdP
$idp, string
$user
)
|
|
Deletes an administrator from the IdP. If the IdP and user combination doesn't match, nothing happens.
Parameters:
IdP |
$idp: |
institution from which the admin is to be deleted. |
string |
$user: |
persistent user ID that is to be deleted as an admin. |
API Tags:
Return: | This function always returns TRUE. |
Access: | public |