|
Tv2 documentation | |||||
PREV NEXT | FRAMES NO FRAME | |||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Security class - manages users, groups and permissions
Field Summary | |
private array | $curr_user Current user data |
private object | $db Database abstraction object: link to db. |
private string | $group_table group table name |
private array | $groups group array |
private array | $sec permission array |
private string | $sec_table permission table name |
private string | $sequence db sequence name |
private string | $ugroup_table user-group table name |
private array | $ugroups links between user and group array elements |
private string | $user_table user table name |
private array | $users user array |
Constructor Summary | |
void | ctlSecurity() Constructor. |
Method Summary | |
boolean | add(string $type, integer $id, string $access, [string $ug], [integer $ug_id]) Add permission on a given object |
mixed | addGroup(string $name) creates new group |
mixed | addUser(string $login, string $pass, [array $groups]) Creates new user |
boolean | check(string $type, integer $id, string $access, [string $ug], [integer $ug_id]) Checks if user has permission to do something. |
private boolean | error(string $msg) Sends an error to the errors object and returns FALSE |
mixed | findGroup(mixed $id) Returns group id for a group name |
mixed | findUser(mixed $id) Returns user id for user name |
mixed | get(string $type, integer $id) Gets permissions of an object |
array | getActiveUser() Alias of ctlSecurity::getCurrentUser |
string | getActiveUserName() Returns login of the current user |
array | getAllGroups() Returns an array of all groups |
array | getAllUsers() Returns an array of all users. |
array | getCurrentUser() Returns current user data |
boolean | isNotDefaultUser() Checks if current user is not default user (usually to check if user is logged in). |
boolean | isRoot() Checks if current user is root user |
boolean | load() Loads data arrays from a database. |
boolean | login(string $login, string $password) Changes current user if login and password match |
boolean | logout() Changes current user to default user. |
boolean | remove(string $type, integer $id, [string $ug], [mixed $ug_id]) Removes permission[s] from an object |
boolean | removeGroup(mixed $id) Removes group. |
boolean | removeUser(integer $id) Removes user. |
boolean | reset(string $type, integer $id, array $permissions) Resets permissions for an object (clears all permissions and creates new permissions) |
array | setActiveUser([mixed $id]) Alias of ctlSecurity::setCurrentUser |
array | setCurrentUser([mixed $id]) Changes current user |
private integer | translatePermission(mixed $string) Changes textual permission into numeric |
private mixed | translateUG(mixed $string) Translates 'u'/'g' string into integer |
boolean | update(string $type, integer $id, mixed $access, string $ug, mixed $ug_id) Updates permissions of an object for a user/group |
mixed | updateGroup(mixed $id, array $data) Changes group data. |
boolean | updateUser(integer $id, array $data) Updates user information (login, password, group membership) |
Field Detail |
private array $curr_user
Current user data
private object $db
Database abstraction object: link to db.
private string $group_table
group table name
private array $groups
group array
private array $sec
permission array
private string $sec_table
permission table name
private string $sequence
db sequence name
private string $ugroup_table
user-group table name
private array $ugroups
links between user and group array elements
private string $user_table
user table name
private array $users
user array
Constructor Detail |
void ctlSecurity()
Constructor. Sets table names.
Method Detail |
boolean add(string $type, integer $id, string $access, [string $ug], [integer $ug_id])
Add permission on a given object
type
- Object typeid
- Object idaccess
- r/w/x/o/d or their integer representationug
- user/group?ug_id
- user/group id.mixed addGroup(string $name)
creates new group
name
- group namemixed addUser(string $login, string $pass, [array $groups])
Creates new user
login
- user login namepass
- user passwordgroups
- array of group namesboolean check(string $type, integer $id, string $access, [string $ug], [integer $ug_id])
Checks if user has permission to do something.
type
- type of permissionid
- Id of object the user is trying to accessaccess
- Access level (r/w/x/o/d or corresponding int values)ug
- user or group? (Needed if you are checking permission not for the current user.)ug_id
- user/group id. (Needed if you are checking permission not for the current user.)private boolean error(string $msg)
Sends an error to the errors object and returns FALSE
msg
- error messagemixed findGroup(mixed $id)
Returns group id for a group name
id
- group id/namemixed findUser(mixed $id)
Returns user id for user name
id
- user id/namemixed get(string $type, integer $id)
Gets permissions of an object
type
- object typeid
- object idarray getActiveUser()
Alias of ctlSecurity::getCurrentUser
string getActiveUserName()
Returns login of the current user
array getAllGroups()
Returns an array of all groups
array getAllUsers()
Returns an array of all users.
array getCurrentUser()
Returns current user data
boolean isNotDefaultUser()
Checks if current user is not default user (usually to check if user is logged in).
boolean isRoot()
Checks if current user is root user
boolean load()
Loads data arrays from a database.
boolean login(string $login, string $password)
Changes current user if login and password match
login
- user login namepassword
- user passwordboolean logout()
Changes current user to default user.
boolean remove(string $type, integer $id, [string $ug], [mixed $ug_id])
Removes permission[s] from an object
type
- object typeid
- object idug
- User 'u' or group 'g'?ug_id
- user/group id or nameboolean removeGroup(mixed $id)
Removes group.
id
- group id/nameboolean removeUser(integer $id)
Removes user.
id
- user idboolean reset(string $type, integer $id, array $permissions)
Resets permissions for an object (clears all permissions and creates new permissions)
type
- object typeid
- object idpermissions
- permission array. Format: array( 0 => array('ug'=>'..', 'user'=>'..', 'access'=>'..'), 1 => array(...))array setActiveUser([mixed $id])
Alias of ctlSecurity::setCurrentUser
id
- user id/namearray setCurrentUser([mixed $id])
Changes current user
id
- user id/nameprivate integer translatePermission(mixed $string)
Changes textual permission into numeric
string
- can be permission string or numeric valueprivate mixed translateUG(mixed $string)
Translates 'u'/'g' string into integer
string
- can be string or integerboolean update(string $type, integer $id, mixed $access, string $ug, mixed $ug_id)
Updates permissions of an object for a user/group
type
- object typeid
- object idaccess
- access levelug
- user 'u' or group 'g'?ug_id
- user/group id or namemixed updateGroup(mixed $id, array $data)
Changes group data.
id
- group id/namedata
- group databoolean updateUser(integer $id, array $data)
Updates user information (login, password, group membership)
id
- user iddata
- user data
|
Tv2 documentation | |||||
PREV NEXT | FRAMES NO FRAME | |||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This document was generated by phpdocgen 0.17-rc3.
Copyright © 2002-03 Stéphane GALLAND (under the GNU General Public License)