phpDocumentor Developer
[ class tree: Developer ] [ index: Developer ] [ all elements ]

Class: UserManagement

Source Location: /core/UserManagement.php

Class UserManagement

Class Overview

This class manages user privileges and bindings to institutions

Located in /core/UserManagement.php [line 37]



		
				Author(s):
		
		
		
Information Tags:

Methods

[ Top ]
Method Summary
UserManagement   __construct()   Class constructor. Nothing special to be done when constructing.
boolean   addAdminToIdp()   Adds a new administrator to an existing IdP
string   checkTokenValidity()   Checks if a given invitation token exists and is valid in the invitations database returns a string with the following values:
IdP   createIdPFromToken()   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().
mixed   createToken()   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().
boolean   invalidateToken()   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.
array   listInstitutionsByAdmin()   For a given persistent user identifier, returns an array of institution identifiers (not the actual objects!) for which this user is the/a administrator.
if   listPendingInvitations()   Retrieves all pending invitations for an institution or for a federation.
boolean   removeAdminFromIdP()   Deletes an administrator from the IdP. If the IdP and user combination doesn't match, nothing happens.

[ Top ]
Methods
Constructor __construct  [line 42]

  UserManagement __construct( )

Class constructor. Nothing special to be done when constructing.


API Tags:
Access:  public


[ Top ]
addAdminToIdp  [line 172]

  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


[ Top ]
checkTokenValidity  [line 66]

  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:
string   $token: 

API Tags:
Access:  public


[ Top ]
createIdPFromToken  [line 99]

  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:
Access:  public


[ Top ]
createToken  [line 213]

  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


[ Top ]
invalidateToken  [line 196]

  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


[ Top ]
listInstitutionsByAdmin  [line 267]

  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


[ Top ]
listPendingInvitations  [line 239]

  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


[ Top ]
removeAdminFromIdP  [line 183]

  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


[ Top ]

Documentation generated on Wed, 08 Apr 2015 07:12:46 +0000 by phpDocumentor 1.4.4