File/user/OCSP_USER.phpclass

Description

Class file OCSP_USER.phpclass

Classes
Class Description
 class OCSP_USER Base class DBMS_TABLEOBJ to handel table data in an object
Includes
 require_once (__OCSP_PHPINCPATH__."db"._OCSP_DIRSEP_."DBMS_TABLEOBJ.phpclass") (line 22)
Constants
_OCSP_USR_SESSION_TTL_ = 600 (line 15)

Class file OCSP_USER.phpclass

Variables
array $OCSP_CONF (line 663)

connects to the db

  • global: $OCSP_CONF 0:
  • version: pk-04-09-28
  • requires: __OCSP_PHPINCPATH__."common/pcf_templates.phpinc"
Functions
addProfile (line 2323)

stores profile data to the database calls addProfileObj() for each value array

old methods

  • return: number of rows added
  • since: pk-05-08-24
int addProfile (int $clpId, array $valArr, [boolean $multiArr = False], [boolean $dataCheck = True], [boolean $debug = False])
  • int $clpId
  • array $valArr
  • boolean $multiArr: if the profile allows multiple entries is $valArr a single entry or an array of entries?
  • boolean $dataCheck: check the data by calling
  • boolean $debug
addProfileObj (line 2368)

stores profile data to the database processes only one data row

old methods

  • since: pk-05-08-24
boolean addProfileObj (CLP_PROFILE $profile, array $valArr, [boolean $dataCheck = True], [boolean $debug = False])
  • CLP_PROFILE $profile
  • array $valArr
  • boolean $dataCheck: check the data by calling
  • boolean $debug
addToGroup (line 1237)

adds the user to $aGrpId

  • since: pk-05-03-02
boolean addToGroup (int $aGrpId, [ $ro = False], [ $asAdmin = False], [boolean $debug = False])
  • int $aGrpId
  • boolean $debug
  • $ro
  • $asAdmin
canEditClient (line 2030)

returns if the user has the right to edit a client

old methods

  • since: pk-05-09-23
boolean canEditClient (int $cliId, [boolean $debug = False])
  • int $cliId
  • boolean $debug
canEditUser (line 1897)

returns if this user has the right to edit another user with id $usrId

old methods

  • version: pk-08-03-12
  • since: pk-06-01-18
boolean canEditUser (mixed $user, [boolean $debug = False])
  • mixed $user: (integer or OCSP_USER)
  • boolean $debug
canListClientType (line 2227)

checks if the user can show users of a type returns always True to the type the users client is

old methods if the type exists the columns

checks if the user is in the show or admin group of the clienttype

boolean canListClientType (int $ctyId, [boolean $debug = False])
  • int $ctyId
  • boolean $debug
canShowClient (line 2014)

returns if the user has the right to view a client's data

old methods

  • since: pk-06-09-08
boolean canShowClient (int $cliId, [boolean $debug = False])
  • int $cliId
  • boolean $debug
canShowUser (line 1867)

returns if this user can see an other user (is in the same group)

old methods

  • since: pk-06-12-17
boolean canShowUser (int $usrId, [boolean $debug = False])
  • int $usrId
  • boolean $debug
checkGroup (line 1795)

old methods

void checkGroup ( $aGroup, [ $withWrite = False], [ $isAdmin = False])
  • $aGroup
  • $withWrite
  • $isAdmin
checkPassword (line 1281)

checks username and password and setts $this->user if ok

  • version: pk-07-02-22 check table version
  • version: pk-07-06-15
  • version: pk-08-03-14
  • since: pk-06-03-15
boolean checkPassword (DBOBJ $dbObj, string $aName, string $aPasswd, [boolean $debug = False])
  • DBOBJ $dbObj
  • string $aName
  • string $aPasswd
  • boolean $debug
checkRights (line 1807)

old methods

void checkRights ( $rights)
  • $rights
checkSEC_REQ (line 1834)

checks security requirements

old methods

  • version: pk-04-10-14
  • version: pk-04-09-28
  • version: pk-05-03-17
  • version: pk-06-07-03
  • version: pk-06-07-23 checking SEC_REQ[GROUP|GROUPWRITE] changed to avoid warnings
  • version: pk-06-08-15 $SEC_REQ['USER'] added
bool checkSEC_REQ (array $SEC_REQ, [bool $debug = False])
  • array $SEC_REQ
  • bool $debug
check_myCliIDTS (line 1935)

returns if myCliIDTS is ok (means not outdated)

old methods

  • since: pk-06-07-21
boolean check_myCliIDTS ()
clearProfileObj (line 2397)

deletes all profile entries for the user

old methods

  • since: pk-05-09-23
void clearProfileObj ( &$profile, [boolean $debug = False], CLP_PROFILE $profile)
  • CLP_PROFILE $profile
  • boolean $debug
  • &$profile
dbInsert (line 860)

inserts a new row to the table

  • return: returns the autoIncFld ID if exists or 1 on success
  • since: pk-08-06-04
int dbInsert ([boolean $debug = False])
  • boolean $debug: show debug info
dbSave (line 840)

only saves none public user

boolean dbSave ([boolean $debug = False])
  • boolean $debug
deleteUser (line 1525)

deletes a user

old methods

  • return: False if the current user has not enough rights to do this
  • since: pk-06-10-04
boolean deleteUser ([boolean $debug = False])
  • boolean $debug
getAdminGroups (line 1569)

returns an array of GRP_ID's where the user is admin

old methods

  • version: pk-08-06-05
array getAdminGroups ([boolean $strict = False], [ $keysOnly = True], [boolean $debug = False], boolean $idsOnly)
  • boolean $strict: only direct assigned groups
  • boolean $idsOnly: return an array with group ids only
  • boolean $debug
  • $keysOnly
getClient (line 2121)

returns a client object for the first client found for the user

old methods

  • version: pk-06-04-19
CLIENT &getClient ([bool $debug = False])
  • bool $debug
getCliId (line 2058)

returns the client id from T_CLI_USER

old methods

  • version: pk-05-12-11 bugfix returns null -> 0
  • version: pk-06-04-19 use $this->myCliId[TS]
  • since: pk-04-10-14
int getCliId ([boolean $debug = False], [boolean $forceReload = False])
  • boolean $debug
  • boolean $forceReload
getCliTypeId (line 2183)

returns the client type id of the users client or False if no client could be found

old methods

  • since: pk-06-07-21
void getCliTypeId ([boolean $debug = False], [ $forceReload = False], boolean $foreachReload)
  • boolean $debug
  • boolean $foreachReload: or use cache (session) if available
  • $forceReload
getDefaultGroupId (line 1049)

returns the default group of the user (GRP_ID in T_SYS_USER)

  • since: pk-06-11-14
int getDefaultGroupId ()
getDirectAssignedAdminGroups (line 1170)

returns an array with group id's direct assigned to the user where he is admin

  • since: pk-08-03-12
array getDirectAssignedAdminGroups ([boolean $forceReload = False], [boolean $debug = False])
  • boolean $forceReload: (reload the groups from the db)
  • boolean $debug
getDirectAssignedGroups (line 1064)

returns an array with group id's direct assigned to the user

  • since: pk-08-03-12
array getDirectAssignedGroups ([boolean $forceReload = False], [boolean $debug = False])
  • boolean $forceReload: (reload the groups from the db)
  • boolean $debug
getGroups (line 1128)

returns a string containing group id's

  • version: pk-05-03-01
  • version: pk-05-09-01
string getGroups ([char $sep = ","], [boolean $forceReload = False], [boolean $debug = False])
  • char $sep
  • boolean $forceReload
  • boolean $debug
getmyClientIds (line 1949)

returns an array of client id's the user is assigned to

old methods

array getmyClientIds ([int $ctyId = 0], [boolean $forceReload = False], [boolean $debug = False])
  • int $ctyId
  • boolean $forceReload
  • boolean $debug
getMyDBObj (line 717)

loading the db object checks dbtype in the following order

1st: $OCSP_CONF['DBTYPE'] 2nd: $_SERVER['DBTYPE'] 3rd: $GLOBALS['OCSP']['DBTYPE'] 4th: set to mySQL

and sets $OCSP_CONF['DBTYPE'] if not isset or is empty

  • version: pk-08-03-14
  • todo: replace global arrays
  • since: pk-07-08-20
  • access: public
OCSP_DB &getMyDBObj ([boolean $withoutConnect = False], [string $dbConffile = ""], [boolean $useGlobal = True], [boolean $debug = False])
  • boolean $withoutConnect: (only return the database object)
  • string $dbConffile
  • boolean $useGlobal
  • boolean $debug
getStaff (line 2152)

returns the staff assigned to the user

old methods

  • since: pk-08-03-02
CLI_STAFF getStaff ([boolean $debug = False])
  • boolean $debug
isAdmin (line 1196)

returns if a user is admin

  • since: pk-04-08-13
boolean isAdmin ([ $debug = False])
  • $debug
isAllowed (line 1419)

checks the user against a merge of $this->curSecReq and $addSecReq

  • since: pk-06-08-15
boolean isAllowed ([array $addSecReq = NULL], [ $debug = False])
  • array $addSecReq
  • $debug
isClientAdmin (line 2257)

checks if the user has admin rights for a client User is group member of CLIENT_ADMIN or T_CLI_USER CLU_ISADMIN is True

old methods uses the array ($this->isCliAdminBuffer to buffer results)

  • since: pk-06-09-15
boolen isClientAdmin ([int $cliId = 0], [boolean $debug = False])
  • int $cliId: if 0 $this->getCliId() is called
  • boolean $debug
isClientStaff (line 2290)

checks if the user is staff of a client

old methods

uses the array ($this->isCliAdminBuffer to buffer results)

  • since: pk-06-10-11
boolen isClientStaff ([int $cliId = 0], [boolean $debug = False])
  • int $cliId: if 0 $this->getCliId() is called
  • boolean $debug
isEnabled (line 1386)

returns if the user is enabled by default

NOTE: does not check current page settings

boolean isEnabled ([$debug $debug = False])
  • $debug $debug
isGroupAdmin (line 1214)

returns if the user is group admin

  • version: pk-06-01-18
  • version: pk-08-06-12
  • since: pk-05-07-07
boolean isGroupAdmin (int $aGrpId, [boolean $debug = False])
  • int $aGrpId
  • boolean $debug
isGroupMember (line 1097)

returns if the user is a member of $aGroup

  • version: pk-08-07-22
boolean isGroupMember (int $aGrpId, [boolean $debug = False])
  • int $aGrpId
  • boolean $debug
isPublic (line 1349)

returns if the user is public or is a logined user

as this function is called durring the dbConnection cal you MUST not use $this->getDBField() method here this will lead to an endless loop.

a user is public if no login name is set

  • version: pk-08-06-02
  • version: pk-08-06-11 don't use $this->getDBField() => endless loop
  • since: pk-05-07-28
boolean isPublic ([boolean $debug = False])
  • boolean $debug
isValid (line 1368)
boolean isValid ([ $debug = False])
  • $debug
login (line 1642)

opens a connection to the database and checks username and password

old methods if username and password don't match the connection is closed else the connection is assigned to $GLOBALS['OCSP_OBJ'][$this->gDBIDX]

sets:

  • isValid
  • isAdmin

  • version: pk-04-09-29
  • version: pk-05-06-27
  • version: pk-05-10-28 $GLOBALS['OCSP']['USR_LOGIN_SHORTENTO'] added
  • deprecated: since pk-08-03-14
boolean login ( $aName,  $aPasswd, [ $aConffile = NULL], [ $asAdmin = False], [ $debug = False])
  • $aName
  • $aPasswd
  • $aConffile
  • $asAdmin
  • $debug
loginScreen (line 1782)

shows the login screen and returns to the current page

old methods

  • todo: only OCSP_AUTH_HTTP implemented
void loginScreen ([int $method = OCSP_AUTH_HTTP], [string $form = ""])
  • int $method: (OCSP_AUTH_xxxx)
  • string $form
logout (line 1756)

logsout the current user

old methods

  • since: pk-04-09-28
void logout ([ $debug = False])
  • $debug
populateMyGroups (line 1016)

populates the groups from the database (T_SYS_GROUPMEMBER)

void populateMyGroups (boolean $debug)
  • boolean $debug
populateUser (line 1847)

not final use override this method to populate the additionl user data

old methods

bool populateUser ([bool $debug = False])
  • bool $debug
removeFromGroup (line 1256)

remove the user from $aGrpId

  • since: pk-05-03-02
boolean removeFromGroup (int $aGrpId, [boolean $debug = False])
  • int $aGrpId
  • boolean $debug
sessPopulate (line 895)

populates a user from the session

void sessPopulate ([boolean $debug = False])
  • boolean $debug
sessSave (line 968)

stores the user to the session

  • version: pk-08-06-11 store only if $this is current user
void sessSave ([boolean $debug = False])
  • boolean $debug
sessTouch (line 998)

sets session user timestamp

void sessTouch ([boolean $debug = False])
  • boolean $debug
setCliId (line 2090)

sets the client id and generates a row in T_CLI_USER

old methods

  • version: pk-06-04-19
  • since: pk-05-10-19
void setCliId (int $cliId, [boolean $overwrite = True], [boolean $debug = False])
  • int $cliId
  • boolean $overwrite: remove all rows for the user in T_CLI_USER
  • boolean $debug
setDBRow (line 818)

sets a database row to the object fields

sets each key (=columname) value

if $row['__OCSP_OBJ_VALS__'] isset and an array this values are set as object values else if $asPopulated object values are loaded

  • since: pk-08-03-14
bool setDBRow (array $row, [boolean $asPopulated = True], [boolean $debug = False])
  • array $row: the row form a select * from DBMS_TABLEOBJ::myTable
  • boolean $asPopulated: set populateTS as if the object has been populated
  • boolean $debug
setMyDBObj (line 684)
  • since: pk-07-08-20
  • access: public
void setMyDBObj ( &$aDBObj, OCSP_DB $aDBObj)
setPassword (line 878)

changes the password

void setPassword (string $newPassword)
  • string $newPassword
setSecRequireArr (line 1401)

merges $secReq with $this->curSecReq

void setSecRequireArr (array $secReq)
  • array $secReq
touch (line 783)

touches the user

void touch ([boolean $toDB = False], [boolean $debug = False])
  • boolean $toDB
  • boolean $debug

Documentation generated on Thu, 08 Jan 2009 17:47:12 +0100 by phpDocumentor 1.4.0a2