Class User
- TableAccess
- User
Direct known subclasses
License: GNU General Public License v2.0 only **********************************************************************************************
Class:
User Diese Klasse dient dazu ein Userobjekt zu erstellen. Ein User kann ueber diese Klasse in der Datenbank verwaltet werden
Beside the methods of the parent class there are the following additional methods:
deleteUserFieldData() - delete all user data of profile fields; user record will not be deleted getListViewRights() - Liefert ein Array mit allen Rollen und der Berechtigung, ob der User die Liste einsehen darf - aehnlich getProperty, allerdings suche ueber usf_id getVCard() - Es wird eine vCard des Users als String zurueckgegeben setRoleMembership($roleId, $startDate = DATE_NOW, $endDate = '9999-12-31', $leader = '') - set a role membership for the current user if memberships to this user and role exists within the period than merge them to one new membership viewProfile - Ueberprueft ob der User das Profil eines uebrgebenen Users einsehen darf viewRole - Ueberprueft ob der User eine uebergebene Rolle(Liste) einsehen darf isAdministrator() - gibt true/false zurueck, falls der User Mitglied der Rolle "Webmaster" ist
Located at user.php
Methods summary
public
|
#
__construct(
Constructor that will create an object of a recordset of the users table. If the id is set than this recordset will be loaded. |
public
|
#
assignDefaultRoles( )
Assign the user to all roles that have set the flag @b rol_default_registration. These flag should be set if you want that every new user should get this role. |
public
boolean
|
#
checkRolesRight( string $right = null )
The method reads all roles where this user has a valid membership and checks the rights of those roles. It stores all rights that the user get at last through one role in an array. In addition the method checks which roles lists the user could see in an separate array. Also an array with all roles where the user has the right to write an email will be stored. The method considered the role leader rights of each role if this is set and the current user is a leader in a role. |
public
true|string
|
#
checkLogin( string $password, boolean $setAutoLogin = false, boolean $updateSessionCookies = true, boolean $updateHash = true, boolean $isAdministrator = false )
Check if a valid password is set for the user and return true if the correct password was set. Optional the current session could be updated to a valid login session. |
public
|
|
public
boolean
|
|
public
true|
|
|
public
|
|
private
int[]
|
|
public
int[]
|
|
public
int[]
|
|
public
integer
|
#
getOrganization( )
Returns the id of the organization this user object has been assigned. This is in the default case the default organization of the config file. |
public
int[]
|
|
public
int[]
|
#
getRoleMembershipsNoLeader( )
Returns an array with all role ids where the user is a member and not a leader of the role. |
public
mixed
|
#
getValue( string $columnName, string $format = '' )
Get the value of a column of the database table if the column has the praefix @b usr_ otherwise the value of the profile field of the table adm_user_data will be returned. If the value was manipulated before with @b setValue than the manipulated value is returned. |
public
string
|
|
public
boolean
|
#
hasRightEditProfile(
Checks if the current user is allowed to edit the profile of the user of the parameter. If will check if user can generally edit all users or if he is a group leader and can edit users of a special role where @b $user is a member or if it's the own profile and he could edit this. |
private
boolean
|
|
public
boolean
|
#
hasRightSendMailToRole( integer $roleId )
Checks if the current user has the right to send an email to the role. |
public
boolean
|
#
hasRightViewProfile(
Checks if the current user is allowed to view the profile of the user of the parameter. If will check if user has edit rights with method editProfile or if the user is a member of a role where the current user has the right to view profiles. |
public
boolean
|
#
hasRightViewRole( integer $roleId )
Check if the user of this object has the right to view the role that is set in the parameter. |
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
|
#
noValueCheck( )
If this method is called than all further calls of method @b setValue will not check the values. The values will be stored in database without any inspections! |
public
boolean
|
#
readDataById( integer $userId )
Reads a user record out of the table adm_users in database selected by the unique user id. Also all profile fields of the object @b mProfileFieldsData will be read. |
public
|
#
renewRoleData( )
Initialize all rights and role membership arrays so that all rights and role memberships will be read from database if another method needs them |
public
boolean
|
#
save( boolean $updateFingerPrint = true )
Save all changed columns of the recordset in table of database. Therefore the class remembers if it's a new record or if only an update is necessary. The update statement will only update the changed columns. If the table has columns for creator or editor than these column with their timestamp will be updated. First save recordset and then save all user fields. After that the session of this got a renew for the user object. If the user doesn't have the right to save data of this user than an exception will be thrown. |
public
|
#
saveChangesWithoutRights( )
If this method is set then a user can save changes to the user if he hasn't the necessary rights |
public
|
#
setOrganization( integer $organizationId )
Set the id of the organization which should be used in this user object. The organization is used to read the rights of the user. If @b setOrganization isn't called than the default organization @b gCurrentOrganization is set for the current user object. |
public
boolean
|
#
setPassword( string $newPassword, boolean $isNewPassword = false, boolean $doHashing = true )
Set a new value for a password column of the database table. The value is only saved in the object. You must call the method @b save to store the new value to the database |
private
boolean
|
#
changeRoleMembership( string $mode, integer $id, string $startDate, string $endDate, boolean $leader )
|
public
boolean
|
#
setRoleMembership( integer $roleId, string $startDate = DATE_NOW, string $endDate = '9999-12-31', boolean $leader = null )
Create a new membership to a role for the current user. If the date range contains a future or past membership of the same role then the two memberships will be merged. In opposite to setRoleMembership this method can't be used to end a membership earlier! |
public
boolean
|
#
editRoleMembership( integer $memberId, string $startDate = DATE_NOW, string $endDate = '9999-12-31', boolean $leader = null )
Edit an existing role membership of the current user. If the new date range contains a future or past membership of the same role then the two memberships will be merged. In opposite to setRoleMembership this method is useful to end a membership earlier. |
public
boolean
|
#
setValue( string $columnName, mixed $newValue, boolean $checkValue = true )
Set a new value for a column of the database table if the column has the prefix @b usr_ otherwise the value of the profile field of the table adm_user_data will set. If the user log is activated than the change of the value will be logged in @b adm_user_log. The value is only saved in the object. You must call the method @b save to store the new value to the database |
public
|
#
updateLoginData( )
Update login data for this user. These are timestamps of last login and reset count and timestamp of invalid logins. |
public
boolean
|
#
editAnnouncements( )
Funktion prueft, ob der angemeldete User Ankuendigungen anlegen und bearbeiten darf |
public
boolean
|
#
approveUsers( )
Funktion prueft, ob der angemeldete User Registrierungen bearbeiten und zuordnen darf |
public
boolean
|
|
public
boolean
|
#
manageRoles( )
Checks if the user has the right to manage roles. Therefore he must be a member of a role with the right @b rol_manage_roles. |
public
boolean
|
|
public
boolean
|
#
editDownloadRight( )
Funktion prueft, ob der angemeldete User Downloads hochladen und verwalten darf |
public
boolean
|
|
public
boolean
|
#
editGuestbookRight( )
Funktion prueft, ob der angemeldete User Gaestebucheintraege loeschen und editieren darf |
public
boolean
|
#
commentGuestbookRight( )
Funktion prueft, ob der angemeldete User Gaestebucheintraege kommentieren darf |
public
boolean
|
|
public
boolean
|
|
public
boolean
|
Methods inherited from TableAccess
__sleep()
,
connectAdditionalTable()
,
countAllRecords()
,
hasColumnsValueChanged()
,
isNewRecord()
,
readData()
,
readDataByColumns()
,
setArray()
,
setDatabase()
Properties summary
protected
|
$administrator
|
|
public
|
$mProfileFieldsData
|
|
public
array
|
$roles_rights
|
#
array()
|
protected
array
|
$listViewRights
|
#
array()
|
protected
array
|
$listMailRights
|
#
array()
|
protected
array
|
$rolesMembership
|
#
array()
|
protected
array
|
$rolesMembershipLeader
|
#
array()
|
protected
array
|
$rolesMembershipNoLeader
|
#
array()
|
protected
|
$organizationId
|
|
protected
|
$assignRoles
|
|
protected
|
$saveChangesWithoutRights
|
|
protected
array
|
$usersEditAllowed
|
#
array()
|
Properties inherited from TableAccess
$additionalTables
,
$columnPrefix
,
$columnsInfos
,
$columnsValueChanged
,
$db
,
$dbColumns
,
$keyColumnName
,
$new_record
,
$tableName