Manual and Documentation

NOTE: This manual describes HammerKit version 3.5. To view documentation for the current release of HammerKit Studio, please go to http://manual.hammerkit.com/
search
Index / D. Object API / Classes / HammerKit_UserGroup

A. Introduction
B. Installation and Configuration
C. Using HammerKit tools
D. Object API
Classes
Button
FileUtils
HammerKit_BasicFile
HammerKit_Color
HammerKit_ColorPalette
HammerKit_Component
HammerKit_Converter
HammerKit_CssRule
HammerKit_Db
HammerKit_DbQueryResult
HammerKit_Document
HammerKit_Element
HammerKit_File
HammerKit_GenericObject
HammerKit_Image
HammerKit_Keyword
HammerKit_ObjectCache
HammerKit_ObjectList
HammerKit_Session
HammerKit_Shortcut
HammerKit_Site
HammerKit_System
HammerKit_User
HammerKit_UserGroup
HammerKit_VariableHandler
Style
Interfaces
Object Choosers
Global Variables
Modules
Tools
Converters
Using the API
E. HammerScript
F. Access Rights
HammerKit_UserGroup


Implements interface: HammerKit_MultilevelObjectInterface

This class describes and contains the functionality for adding, removing and managing user groups and their attributes. A user group is identified by its database id, which is an integer number. The user group identified by the number 0 is a virtual user group referring to the root of the user group hierarchy.



Attributes

boolean active
Description:
Settable: yes

string box
Description:
Settable: yes

string city
Description:
Settable: yes

string country
Description:
Settable: yes

string email
Description:
Settable: yes

integer(HammerKit_File) folder
Description: the id of the user group's file folder
Settable: no

unique integer(HammerKit_UserGroup) id
Description: the database id number of the user group
Settable: no

integer(HammerKit_File) image
Description:
Settable: yes

integer member_count
Description: contains the value returned by the getMemberCount method
Settable: no

string mobile
Description:
Settable: yes

string name
Description:
Settable: yes

string(HammerKit_Site) origin
Description: the name of the site in which the group was created
Settable: no

integer(HammerKit_UserGroup) parent_id
Description:
Settable: no (altered through the move method)

string street
Description:
Settable: yes

string tel
Description:
Settable: yes

string type
Description:
Settable: yes
Possible values: "local", "global"

string url
Description:
Settable: yes

integer usergroup_count
Description: contains the value returned by the getSubgroupCount method
Settable: no

time valid_from
Description:
Settable: yes

time valid_to
Description:
Settable: yes

string zip
Description:
Settable: yes


Methods

constructor __construct(integer usergroup_id [, string db=$GLOBALS["cfg"]->users_db])
Description: creates a user group object
Arguments: usergroup_id is the database id of the user group to create
Returns: a user group object

boolean addMembership(integer user_id)
Description: adds member users to the group
Arguments: user_id is the database id of the user to add to the group
Returns: TRUE on success and FALSE otherwise

integer(HammerKit_UserGroup) addUsergroup(array attributes)
Description: creates a new subgroup under the current user group
Arguments: attributes is an array of user group attributes
Returns: on success the id of the created user group, otherwise FALSE

string getAttribute(string attribute)
Description: gets the value of a user group attribute
Arguments: attribute is the name of a user group attribute
Returns: the value of the attribute and FALSE if the given attribute is invalid

array getAttributeList(void)
Description: returns an array describing all the possible attributes for a user group object
Returns: the array of attributes where the keys are the attribute names and the values are arrays containing the properties of the attributes

string getChooser(string name [, string value [, array specials [, array settings [, array options]]]])
Description: see the description of the HammerKit_ObjectInterface interface

HammerKit_ObjectList(HammerKit_Component) getList([array where])
Description: see the description of the HammerKit_ObjectInterface interface

integer getMemberCount(void)
Description: get the number of member users of the current user group
Returns: the member count

array getMemberList([string sort_attribute [, boolean reverse_order]])
Description: get a list of all the users with memberships to the current user group
Arguments: sort_attribute is the user attribute by which to sort the members list - default value is "lastname", reverse_order determines if the list is returned in reverse order - default value FALSE
Returns: an array of user ids

mixed getPath([string attribute [, string separator]])
Description: this method returns either a sorted array of user groups or a string of user group attribute values separated by some separator
Arguments: attribute is a user group attribute - default value is an empty string "", separator is a string by which the attribute values are separated - default value is " / "
Returns: the method returns an array of user group objects if attribute is left empty, else the method returns a string with attribute values separated by separator

integer getUsergroupCount(void)
Description: get the number of subgroups under the current user group
Returns: the subgroup count

array getUsergroupList([string sort_attribute [, boolean reverse_order]])
Description: get a list of all the subgroups under the current user group
Arguments: sort_attribute is the user group attribute by which to sort the subgroups list - default value is "name", reverse_order determines if the list is returned in reverse order - default value FALSE
Returns: an array of user group ids

boolean isAncestorOf(integer usergroup_id)
Description: check if the current user group is an ancestor of another user group
Arguments: usergroup_id is the database id of a user group
Returns: TRUE if is an ancestor and FALSE otherwise

boolean move(integer usergroup_id)
Description: move a user group under another user group
Arguments: usergroup_id is the database id of a user group
Returns: true on success and false otherwise

boolean removeMembership(integer user_id)
Description: removes the membership to the current user group from a user
Arguments: user_id is the id of the user to remove
Returns: TRUE on success and FALSE otherwise

boolean remove(void)
Description: removes a user group from the database
Returns: TRUE on success and FALSE otherwise

boolean setAccessRight(string object_type, string object_id, string right, string site_name)
Description: gives the group an access right to a HammerKit object in some site
Arguments: object_type is either "component", "file", "module", "site" or "tool", object_id is the database id of the object, right is either "deny", "read", "write" or "admin", if right is empty a previously set access right to this object is removed, site_name is the name of the site for whose object the right is set
Returns: TRUE on success and FALSE otherwise

boolean setAttributes(array attributes)
Description: sets the values of settable user group attributes to the database
Arguments: attributes is an array where the keys are valid user group object attribute names and the values are the corresponding values of the attributes
Returns: TRUE on success and FALSE otherwise



� HammerKit Oy 2008 UPDATED: 02.12.2008 15:24