ClearFoundation

ClearOS API

Class Group

Description

System group manager.

Provides tools for managing user defined groups on the system. For now, Only the Group->Exists() method uses both LDAP and Posix groups. All other public methods refer to LDAP groups only.

Groups have been segregated into three distinct ID rangs:

  • System groups: 0-499
  • User groups: 500-60000
  • Normal groups: 60001-62000

Located in /api/Group.class.php (line 117)

Engine
   |
   --Group
Class Constant Summary
Variable Summary
mixed $groupname
mixed $info
mixed $ldaph
mixed $loaded
mixed $usermap_dn
Method Summary
void Add (string $description, [ $members = array()])
false AddMember (string $username)
void Delete ()
false DeleteMember (string $username)
boolean Exists ()
string GetDescription ()
integer GetGid ()
array GetMembers ()
boolean IsValidDescription (string $description)
boolean IsValidGroupname (string $groupname)
void SetDescription (string $description)
void SetMembers (array $members)
void __construct (string $groupname)
void __destruct ()
void _GetLdapHandle ()
void _LoadGroupInfo ()
Variables
mixed $groupname = null (line 124)
  • access: protected
mixed $info = null (line 125)
  • access: protected
mixed $ldaph = null (line 123)
  • access: protected
mixed $loaded = false (line 126)
  • access: protected
mixed $usermap_dn = null (line 127)
  • access: protected
mixed $usermap_username = null (line 128)
  • access: protected

Inherited Variables

Inherited from Engine

Engine::$errors
Methods
Add (line 182)

Adds a group to the system.

  • throws: ValidationException, EngineException
void Add (string $description, [ $members = array()])
  • string $description: group description
  • $members
AddMember (line 240)

Adds a member to a group.

  • return: if user was already a member
  • throws: ValidationException, EngineException
false AddMember (string $username)
  • string $username: username
Delete (line 264)

Deletes a group from the system.

  • throws: GroupNotFoundException, EngineException
void Delete ()
DeleteMember (line 295)

Deletes a member from a group.

  • return: if user was already not a member
  • throws: ValidationException, EngineException
false DeleteMember (string $username)
  • string $username: username
Exists (line 325)

Checks the existence of the group.

  • return: true if group exists
  • throws: EngineException
boolean Exists ()
GetDescription (line 384)

Returns the group description.

  • return: group description
  • throws: GroupNotFoundException, EngineException
string GetDescription ()
GetGid (line 366)

Returns the group ID.

  • return: group ID
  • throws: GroupNotFoundException, EngineException
integer GetGid ()
GetMembers (line 348)

Returns a list of group members.

  • return: list of group members
  • throws: GroupNotFoundException, EngineException
array GetMembers ()
IsValidDescription (line 495)

Validation routine for group description.

  • return: true if description is valid
boolean IsValidDescription (string $description)
  • string $description: description
IsValidGroupname (line 517)

Validation routine for group name.

Groups must begin with a letter and allow underscores.

  • return: true if group name is valid
boolean IsValidGroupname (string $groupname)
  • string $groupname: groupname
SetDescription (line 405)

Sets the group description.

  • throws: GroupNotFoundException, EngineException, ValidationException
void SetDescription (string $description)
  • string $description: group description
SetMembers (line 436)

Sets the group member list.

  • throws: GroupNotFoundException, EngineException, ValidationException
void SetMembers (array $members)
  • array $members: array of group members
Constructor __construct (line 162)

Group constructor.

void __construct (string $groupname)
  • string $groupname: group name.

Redefinition of:
Engine::__construct()
Engine constructor.
Destructor __destruct (line 885)
  • access: public
void __destruct ()

Redefinition of:
Engine::__destruct()
_GetLdapHandle (line 646)

Creates an LDAP handle.

  • throws: EngineException
  • access: protected
void _GetLdapHandle ()
_LoadGroupFromLdap (line 695)

Loads group from LDAP.

  • throws: EngineException
  • access: protected
void _LoadGroupFromLdap ()
_LoadGroupFromPosix (line 780)

Loads group from Posix.

  • throws: EngineException
  • access: protected
void _LoadGroupFromPosix ()
_LoadGroupInfo (line 864)

Loads group from information.

This method loads group information from LDAP if the group exists, otherwise, group information is loaded from /etc/groups.

  • throws: GroupNotFoundException, EngineException
  • access: protected
void _LoadGroupInfo ()
_LoadUsermapFromLdap (line 741)

Loads group list arrays to help with mapping usernames to DNs.

RFC2307bis lists a group of users by DN (which is a CN/common name in our implementation). Since we prefer seeing a group listed by usernames, this method is used to create two hash arrays to map the usernames and DNs.

  • access: protected
void _LoadUsermapFromLdap ()

Inherited Methods

Inherited From Engine

Engine::__construct()
Engine::AddValidationError()
Engine::CheckValidationErrors()
Engine::CopyValidationErrors()
Engine::GetValidationErrors()
Engine::Log()
Engine::__destruct()
Class Constants
CONSTANT_ALL_USERS_GROUP = 'allusers' (line 140)
CONSTANT_ALL_USERS_GROUP_ID = '400' (line 141)
CONSTANT_ALL_WINDOWS_USERS_GROUP = 'domain_users' (line 139)
CONSTANT_NO_MEMBERS_DN = 'No Members' (line 138)
CONSTANT_NO_MEMBERS_USERNAME = 'nomembers' (line 137)
FILE_CONFIG = '/etc/group' (line 131)
GID_RANGE_GROUP_MAX = '62000' (line 147)
GID_RANGE_GROUP_MIN = '60001' (line 146)
GID_RANGE_GROUP_WINDOWS_MAX = '20000000' (line 149)
GID_RANGE_GROUP_WINDOWS_MIN = '1000000' (line 148)
GID_RANGE_SYSTEM_MAX = '499' (line 143)
GID_RANGE_SYSTEM_MIN = '0' (line 142)
GID_RANGE_USER_MAX = '60000' (line 145)
GID_RANGE_USER_MIN = '500' (line 144)
LOG_TAG = 'group' (line 130)
TYPE_GROUP = 'group' (line 134)
TYPE_INVALID = 'invalid' (line 136)
TYPE_SYSTEM = 'system' (line 132)
TYPE_USER = 'user' (line 133)
TYPE_WINDOWS_GROUP = 'wingroup' (line 135)

Inherited Constants

Inherited from Engine

Engine::COMMAND_API

Documentation generated on Fri, 28 Aug 2009 20:32:10 -0400 by phpDocumentor 1.3.2