user_class Class Reference

Users can log onto the Monitor GUI and see the objects that they are configured to see. More...

Inheritance diagram for user_class:
object_class

Public Member Functions

 get_properties ()
 Fetches the properties for the current object type.
 get_object_by_name ($username)
 __construct ($id=false)
 constructor
 get_object_name ()
 Returns the name of the object in question.
 set_password ($password)
 Set user password.
 save_object ($user=true)
 validate_object ()
 Validates an object prior to saving it to database.
 delete_object ()
 Delete object after validating that it is safe to do so.
 banish_object ($user=true)
 The 'real' delete function.
 get_cmd_bar_links ()
 Returns a list of actions that are legal for this object type.
 get_objects_for_user ($obj_type=false)
 Thin wrapper for returning user's objects of an optionally specified type.
 normalize ($obj=false, $abort_on_error=true)
 Takes the any given object (or the current one) and normalizes it.
 denormalize ($obj=false)
 Takes the any given object (or the current one) and makes it denormalized.

Static Public Member Functions

static get_users ()
 Read the rights and password files and statically store the data therein.
static write_users ()
 Write user files to disk.
static object_exists ($obj, $id)
 Check if an object of the specified type and id exists.

Data Fields

 $lazy_write = false
 If true, don't automatically generate auth_users.yml - performance option when handling many users.
 $properties
 This object's properties (required vars, allowed values etc).
 $type = 'user'
 type name
 $db_table = 'username'
 doesn't actually exist, but it's the correct join pre-/suffix

Detailed Description

Users can log onto the Monitor GUI and see the objects that they are configured to see.

This differs from the concept of contacts, who doesn't necessarily have access to the GUI.


Member Function Documentation

user_class::banish_object ( user = true  ) 

The 'real' delete function.

Parameters:
$user true if this was a user-initiated delete. Set to false when doing things that shouldn't show up in the changelog, such as undoes.

Error or success messages can be retrieved from get_deletion_message()

Returns:
True if the object was deleted, False otherwise.

Reimplemented from object_class.

user_class::delete_object (  ) 

Delete object after validating that it is safe to do so.

.. Delete exactly one object of the type $obj_type match topic value against topic to work around pressing 'reload'

This method is adapted from previous version to use object variables and NOT to print anything - only return true or array with messages to the user to be handled by the gui.

This method calls banish_object() to do the actual deletion (mostly). Call banish_object() straight away if you want to force the deletion.

Error or success messages can be retrieved from get_deletion_message()

Returns:
True if the object was deleted, False otherwise.

Reimplemented from object_class.

user_class::denormalize ( obj = false  ) 

Takes the any given object (or the current one) and makes it denormalized.

That is, objects are normally stored in 3rd normal form (with id values instead of actual names to other objects). This function takes a normalized object and returns a denormalized one with all ids expanded to their proper names.

Exceptions:
NacomaRelationException 

Reimplemented from object_class.

user_class::get_object_by_name ( username  ) 
Parameters:
$username 
Returns:
user_class|false

Reimplemented from object_class.

user_class::normalize ( obj = false,
abort_on_error = true 
)

Takes the any given object (or the current one) and normalizes it.

That is, objects which have textual representations of objects they link to get those textual representations replaced with the linked-to objects' database id numbers in this method. The result replaces the current object.

This method will not remove the old state. If you want that, call self::get_default_object first.

Parameters:
$obj the object state to normalize, in case it's not $this->obj
$abort_on_error If false, drop invalid variables silently.
Exceptions:
NacomaRelationException 

Reimplemented from object_class.

static user_class::object_exists ( obj_type,
id 
) [static]

Check if an object of the specified type and id exists.

Objects 'exist' if they're mentioned in the Object_Index_Table for their class. This can mean that they exist in limbo if the programmer added it via the 'add_to_object_index_table()' function, but we need to live with that.

Parameters:
$obj_type string; Object type to check for
$id integer; Id of the object to find

Reimplemented from object_class.

user_class::save_object ( user = true  ) 
Parameters:
$user 
Returns:
boolean

Reimplemented from object_class.

user_class::set_password ( password  ) 

Set user password.

Parameters:
$password 
user_class::validate_object (  ) 

Validates an object prior to saving it to database.

This function ensures that the object being validated:

  • has all the required variables
  • doesn't rely on an object that doesn't exist
  • has valid input for 'int', 'bool' and 'checkbox' fields

Reimplemented from object_class.

static user_class::write_users (  )  [static]

Write user files to disk.

If you set $lazy_write to true, this must be manually called, otherwise it will be called automatically at the end of relevant methods

Depends on self::read_users(), which should be solved in self::__construct()


Field Documentation

user_class::$properties
Initial value:
 array(
                'var_index' => array(
                        'username'              => 'string',
                        'realname'              => 'string',
                        'password'              => 'password',
                        'groups'                => 'mselect',
                        'Access Levels' => 'norender' 
                ),
                'default' => array(
                        'realname'              => '',
                        'password'              => '',
                        'groups'                => '',
                ),
                'special' => array(
                        'groups'                => 'group'
                ),
                'required' => array(),
                'label' => array(
                        'realname'              => 'Real name',
                        'password'              => 'Password<br>Repeat',
                        'groups'                => 'Group Membership'
                        ),
                'topic' => 'username',
                'deprecated_names' => array(
                        'Username' => 'username',
                        'Realname' => 'realname',
                        'Password' => 'password',
                        'Role' => 'groups'
                )
        )

This object's properties (required vars, allowed values etc).

Reimplemented from object_class.


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables

Generated on 6 May 2013 for nacoma by  doxygen 1.6.1