dev.obliquid.com: obliquid
[ class tree: obliquid ] [ index: obliquid ] [ all elements ]

Class: user

Source Location: Program_Root/classes/obliquid/user.php

Class Overview


Main class for user module.


Methods


Inherited Variables

Inherited Methods


Class Details

[line 29]
Main class for user module.





[ Top ]


Class Methods


method addGroup [line 42]

integer addGroup( array $groupname, array $description, [boolean $is_role = false])

Adds a new group.

groupname and descriptions are associative array to support multiple languages, before being saved in database they are serialized and base64 encoded.




Tags:

return:  Id for the newly created group in case of success, 0 otherwise


Parameters:

array   $groupname   associative array with a key for each supported languages. ex. array("en_US" => "customers", "it_IT" => "clienti")
array   $description   associative array ex. array("en_US" => "a description", "it_IT" => "una descrizione")
boolean   $is_role   tells if it's a normal group or a role

[ Top ]

method addUserGroup [line 579]

void addUserGroup( integer $id_person, integer $id_group)

Add a group to a user





Parameters:

integer   $id_person   our user
integer   $id_group   our group

[ Top ]

method canViewUser [line 512]

true canViewUser( integer $id_person)

Check for authorization to view a person. A person can be viewed if belongs to at least one of the groups we're allowed to see.



Tags:

return:  if the current user has proper authorization, false otherwise


Parameters:

integer   $id_person   - id of the person to be checked

[ Top ]

method delete [line 551]

true delete( integer $id_person)

Delete a user



Tags:

return:  in case of success, false otherwise


Parameters:

integer   $id_person   user to be deleted

[ Top ]

method deleteUserGroup [line 595]

void deleteUserGroup( integer $id_person, integer $id_group)

Delete a group from a user





Parameters:

integer   $id_person   our user
integer   $id_group   our group

[ Top ]

method delGroup [line 101]

boolean delGroup( integer $id_group)

Deletes an existing group.

if the group has members, the memberships are removed (not the members) if the group has associated operations, those associations are removed if the group has associated roles, those associations are removed




Tags:

return:  true if success, false otherwise


Parameters:

integer   $id_group   id_group to be deleted

[ Top ]

method ensure_has [line 395]

boolean ensure_has( string $a, string $b, string $c, string $t)

Checks to see if the requested security object has some access defined.

If nobody has access, then an entry is created, and access is given to the group of the individual current running. Typically, this would be used when creating a restricted table entry so that somebody can get to it.




Tags:

return:  - true if a new security entry created.
  • false if a security already existed for this item (this does not mean the current user has access.


Parameters:

string   $a   part A of the security object
string   $b   part B of the security object
string   $c   part C of the security object
string   $t   the type of this security object (s, n, o, t)

[ Top ]

method getUsers [line 486]

array &getUsers( [integer $id_group = 0])

Returns a list of users of a group



Tags:

return:  an index array of users, each record being an index array with id_person in position 0 and organization in position 1 (limited to 40 chars). If organization is empty surname and name is returned instead


Parameters:

integer   $id_group   an optional group filter

[ Top ]

method groupIds [line 198]

string groupIds( integer $id_person)

Returns a comma separated list of group ids, given a id_person



Tags:

return:  list of group id of the person. ex. "2,4"


Parameters:

integer   $id_person   person id

[ Top ]

method groupIdToNames [line 180]

text groupIdToNames( text $groupIds)

Returns a comma separated list of group names in the current language,

given a comma separated list of groupIds




Tags:

return:  a list of group names in current language ex. "Administrators, Customers"


Parameters:

text   $groupIds   a string with comma separated list of groups ex. "2,3"

[ Top ]

method groupInfo [line 150]

boolean groupInfo( integer $id_group, text &$groupname, mixed &$groupdesc, text $description)

Returns information about an existing group in the current language.

Special group Ids: ** Everyone, u0 Not signed on, g* Signed on




Tags:

return:  true if can read group info, false otherwise


Parameters:

integer   $id_group   group id
text   $groupname   groupname in the current language
text   $description   group description in the current language

[ Top ]

method has [line 376]

boolean has( $id_module $id_module, $name $name, [mixed $c = ""])

Checks if a user has a given operation.



Tags:

return:  true the user has the operation


Parameters:

$id_module   $id_module   integer module id
$name   $name   string operation name

[ Top ]

method hasGroup [line 536]

true hasGroup( integer $id_person, integer $id_group)

Check if a certain user belongs to a certain group



Tags:

return:  if the user belongs to the group, false otherwise


Parameters:

integer   $id_person   - id of the person to be checked
integer   $id_group   - id of the group to be checked

[ Top ]

method listGroups [line 223]

array &listGroups( [mixed $get = "G"], text $gets)

Lists available groups in associative array.

returns an index array of available groups, each element of the array is an associative array with keys id_group, groupname, description. groupname and description are returned in the current language if they are available, otherwise in another language according to site priorities. The array is sorted in order of groupname. Only groups allowed to be viewed by the current user are returned.




Tags:

return:  index array with available groups


Parameters:

text   $gets   Default: G = get groups, R = get roles, B = get both

[ Top ]

method listGroupsForSelect [line 267]

array &listGroupsForSelect( [mixed $get = "G"], text $gets)

Lists available groups in index array suitable for db_form::getSelect() returns an index array of available groups, each element of the array is an index array with id_group in position 0 and groupname in position 1.

groupname and description are returned in the current language if they are available, otherwise in another language according to site priorities. The array is sorted in order of groupname. Only groups allowed to be viewed by the current user are returned.




Tags:

return:  index array with available groups


Parameters:

text   $gets   Default: G = get groups, R = get roles, B = get both

[ Top ]

method listUserGroups [line 286]

array &listUserGroups( integer $id_person)

Lists groups to which the user belongs

returns an index array of groups of a person, each element of the array is an associative array with keys id_group, groupname, description groupname and description are returned in the current language if they are available, otherwise in another language according to site priorities the array is sorted in order of groupname.




Tags:

return:  index array of groups of a person


Parameters:

integer   $id_person   person id

[ Top ]

method loadRole [line 423]

integer loadRole( $filename $filename, [$id_group $id_group = 0], [$id_security $id_security = 0])

Loads a role from a role definition file



Tags:

return:  number of security objects inserted


Parameters:

$filename   $filename   filename to load
$id_group   $id_group   id of the role the file has to be loaded into, if it's not present it's created
$id_security   $id_security   optional parameter with the first id_security to be used. If it's not present the sequence will be used instead. This parameter should be used only by setup.php

[ Top ]

method modGroup [line 73]

boolean modGroup( integer $id_group, array $groupname, array $description, [mixed $is_role = 0], integer $id_role)

Modifies an existing group.



Tags:

return:  true in case of success, false otherwise


Parameters:

integer   $id_group   group id
array   $groupname   associative array with a key for each supported language
array   $description   associative array with a key for each supported languages
integer   $id_role   says if it's a role or a group (0/1)

[ Top ]

method peekHas [line 323]

boolean peekHas( mixed $a, mixed $b, mixed $c, [mixed $p = 0])

Checks the authorization to a security object for any person.

If no person Id is supplied, it checks the current user. NOTE: this does not cache the result if the person ID is supplied, so it is not recommended that it be used to check authorization for the logged on user by user Id. This function is in user instead of obliquidweb because it should not be used frequently.




Tags:

return:  true in case the person is authorized, false if he isn't


[ Top ]

method readGroup [line 130]

boolean readGroup( integer $id_group, array &$groupname, array &$description)

Returns information about an existing group as assoc arrays.

groupnames and descriptions are returned by reference as associative array with locales as keys.




Tags:

return:  true if can read group info, false otherwise


Parameters:

integer   $id_group   group id
array   $groupname   will be filled with groupnames
array   $description   will be filled with descriptions

[ Top ]


Documentation generated on Tue, 29 Mar 2005 09:04:44 -0800 by phpDocumentor 1.2.0rc2