go-basic
[ class tree: go-basic ] [ index: go-basic ] [ all elements ]

Class: GO_USERS

Source Location: /classes/base/users.class.inc.php

Class Overview

base_db
   |
   --db
      |
      --GO_USERS

This class is used to manage users in Group-Office.


Author(s):

Version:

  • $Id: users.class.inc.php 1294 2008-10-30 13:07:15Z mschering $

Copyright:

  • Copyright Intermesh

Methods


Inherited Variables

Inherited Methods

Class: db

db::affected_rows()
Gets the number of affected rows in a previous MySQL operatio
db::connect()
Connnects to the database
db::escape()
Escapes a value to make it safe to send to MySQL
db::found_rows()
Returns the number of rows found when you have used SELECT SQL_CALC_FOUND_ROWS
db::free()
Frees the memory associated with a result
db::insert_id()
Returns the auto generated id used in the last query
db::next_record()
Walk the result set from a select query
db::num_fields()
Get the number of fields in a result
db::num_rows()
Return the number of rows found in the last select statement
db::query()
Queries the database
db::set_error()
Sets the error and errno property
db::__wakeup()
When this object is stored in a session it must reconnect when created by the session again.

Class: base_db

base_db::__construct()
Constructor a config object with db_host, db_pass, db_user and db_name may be passed so it can connect to a different database then the default.
base_db::affected_rows()
Gets the number of affected rows in a previous MySQL operatio
base_db::connect()
Connnects to the database
base_db::escape()
Escapes a value to make it safe to send to MySQL
base_db::f()
Fetch a single field from a result record
base_db::found_rows()
Returns the number of rows found when you have used SELECT SQL_CALC_FOUND_ROWS
base_db::free()
Frees the memory associated with a result
base_db::halt()
Halts when an error occurs
base_db::insert_id()
Returns the auto generated id used in the last query
base_db::insert_row()
Inserts a row in a table
base_db::lock()
Lock a table
base_db::nextid()
Get a next unique ID for a table. Used instead of auto increment so that we have better support for different database backends.
base_db::next_record()
Walk the reseult set from a select query
base_db::num_fields()
Get the number of fields in a result
base_db::num_rows()
Return the number of rows found in the last select statement
base_db::p()
Print a single field from a result record.
base_db::query()
Queries the database
base_db::replace_row()
Replaces a row in a table
base_db::set_config()
Set's the connection parameters. A config object with db_host, db_pass, db_user and db_name may be passed so it can connect to a different database then the default.
base_db::set_error()
Sets the error and errno property
base_db::set_parameters()
Set the connection parameters manually
base_db::unlock()
Unlock tables
base_db::update_row()
Updates a row from a table

Class Details

[line 28]
This class is used to manage users in Group-Office.

Tags:

author:  Merijn Schering <mschering@intermesh.nl>
version:  $Id: users.class.inc.php 1294 2008-10-30 13:07:15Z mschering $
copyright:  Copyright Intermesh
since:  Group-Office 2.05
uses:  db


[ Top ]


Class Methods


constructor __construct [line 40]

GO_USERS __construct( )

The constructor initializes the SQL database connection.

Some functionality is global and therefore implemented in this class, and not in the child classes. For this functions a database connection is needed, so we initialize it in the constructor. There is no need to do anything else here.

Tags:

access:  public
Overrides base_db::__construct() (Constructor a config object with db_host, db_pass, db_user and db_name may be passed so it can connect to a different database then the default.)
[ Top ]

method add_user [line 735]

bool add_user( string $user, [string $user_groups = array()], [string $visible_user_groups = array()], [string $modules_read = array()], [string $modules_write = array()], [string $acl = array()])

This function adds a new user to the database.

Tags:

return:  True on success
access:  public

Parameters:

string   $user   Array of all columns of table 'go_users'
string   $user_groups   The user group id's the user will be member of
string   $visible_user_groups   The user group id's where the user will be visible to
string   $modules_read   The modules the user will have read permissions for
string   $modules_write   The modules the user will have write permissions for
string   $acl   Some custom ACL id's the user will have access to (Be careful)

[ Top ]

method cache_user [line 1053]

void cache_user( $user_id, int $last_sync_time)

When a global search action is performed this function will be called for each module

Parameters:

int   $last_sync_time   The time this function was called last
   $user_id  

[ Top ]

method check_password [line 471]

bool check_password( string $password)

This function checks if the password the user supplied is valid.

Tags:

access:  public

Parameters:

string   $password  

[ Top ]

method delete_user [line 928]

bool delete_user( int $user_id)

This function deletes a user from the database.

Tags:

access:  public

Parameters:

int   $user_id  

[ Top ]

method email_exists [line 708]

bool email_exists( string $email)

This function checks, if there is already a user with the given email address.

Tags:

return:  True if exists
access:  public

Parameters:

string   $email  

[ Top ]

method get_authorized_users [line 387]

int get_authorized_users( $user_id, [string $sort = "name"], [string $direction = "ASC"], int $start, int $offset)

This function retrieves all users that are visible to a user.

This function fetches all users that should be visible to the given user. next_record() can be used to iterate over the result set.

Tags:

return:  The number of users
access:  public

Parameters:

string   $sort   The field to sort on
string   $direction   The sort direction
int   $start   Return results starting from this row
int   $offset   Return this number of rows
   $user_id  

[ Top ]

method get_authorized_user_by_email [line 447]

array get_authorized_user_by_email( int $user_id, $email, string $username)

This function returns all userdata based on the user's name.

Tags:

return:  The user profile
access:  public

Parameters:

int   $user_id   The user to check access for
string   $username  
   $email  

[ Top ]

method get_linked_users [line 304]

void get_linked_users( $user_id, $link_id)

Parameters:

   $user_id  
   $link_id  

[ Top ]

method get_search_fields [line 152]

array get_search_fields( void 0)

This function returns an array of the fields that can be used as search criterias for users.

Tags:

access:  public

Parameters:

void   0  

[ Top ]

method get_user [line 489]

array get_user( int $user_id)

This function searches for a user by his ID andreturns all userdata based on the users ID.

Tags:

access:  public

Parameters:

int   $user_id  

[ Top ]

method get_users [line 339]

int get_users( [string $sort = "name"], [string $direction = "ASC"], [int $start = 0], [int $offset = 0])

Fetch all users from the user management backend.

This function retrieves all users from the database and returns their number. After that you are able to process each user via next_record.

over the different user accounts. next_user() should be considered.

Tags:

return:  The number of users
access:  public

Parameters:

string   $sort   The field to sort on
string   $direction   The sort direction
int   $start   Return results starting from this row
int   $offset   Return this number of rows

[ Top ]

method get_user_by_email [line 421]

array get_user_by_email( string $email)

This function searches for a user by his email address.

This function retrieves all userdata based on the users email address.

Tags:

access:  public

Parameters:

string   $email   The e-mail address of a user

[ Top ]

method get_user_by_username [line 688]

array get_user_by_username( string $username)

This function returns all userdata based on the user's name.

Tags:

return:  The user profile
access:  public

Parameters:

string   $username  

[ Top ]

method increment_logins [line 963]

void increment_logins( $user_id)

Parameters:

   $user_id  

[ Top ]

method max_users_reached [line 907]

bool max_users_reached( void 0)

This function tells us if we exceeded the maximum number of users if set in config.php

Tags:

access:  public

Parameters:

void   0  

[ Top ]

method random_password [line 981]

string random_password( [string $characters_allow = 'a-z,1-9'], [string $characters_disallow = 'i,o'], [int $password_length = 4], [int $repeat = 0])

This function generates a randomized password.

Tags:

access:  public

Parameters:

string   $characters_allow  
string   $characters_disallow  
int   $password_length  
int   $repeat  

[ Top ]

method search [line 190]

array search( string $query, string $field, [int $user_id = 0], [int $start = 0], [int $offset = 0], [ $sort = "name"], [ $sort_direction = 'ASC'])

This function searches for users with the given search field.

Tags:

access:  public

Parameters:

string   $query  
string   $field  
int   $user_id  
int   $start  
int   $offset  
   $sort  
   $sort_direction  

[ Top ]

method update_profile [line 620]

Boolean update_profile( Array $user, [ $complete_profile = false])

This function updates a the profile of a user.

Using an SQL update record, this function actualizes the profile of the given user.

Tags:

return:  to indicate the success of the operation.
access:  protected

Parameters:

Array   $user   is an array of all data that should be updated.
   $complete_profile  

[ Top ]

method update_session [line 94]

bool update_session( int $user_id, [ $update_language = false])

Updates the session data corresponding to the user_id.

Tags:

access:  public

Parameters:

int   $user_id  
   $update_language  

[ Top ]

method update_user [line 512]

bool update_user( $user, [ $user_groups = null], [ $visible_user_groups = null], [ $modules_read = null], [ $modules_write = null])

This function updates all userdata based on the given parameters.

Tags:

return:  True on success
access:  public

Parameters:

   $user  
   $user_groups  
   $visible_user_groups  
   $modules_read  
   $modules_write  

[ Top ]


Documentation generated on Thu, 30 Oct 2008 14:13:55 +0100 by phpDocumentor 1.4.0