Index


NAME

Top

LATMOS::Accounts::Bases - Base class for account data bases

SYNOPSIS

Top

  use LATMOS::Accounts::Bases;
  my $base = LATMOS::Accounts::Bases->new('type', %options);
  ...

DESCRIPTION

Top

This module provide basic functions for various account base

FUNCTIONS

Top

new($type, %options)

Return, if success, a new data base account object, $type is account base type, %options to setup the base.

SetCallBack( $cb, $code )

Set callbalc $<cb> to function $code.

GetCallBack( $cb )

Set callback $<cb> to function $code.

load

Make account base loading data into memory if need. Should always be called, if database fetch data on the fly (SQL, LDAP), the function just return True.

label

Return the database label

type

Return the type of the base

la

return LATMOS::Accounts object parent to the base

config ($opt)

Return options from config

wexported

See unexported

unexported ($wexported)

Set base to report unexported object or not

temp_switch_unexported($CODE, $value)

Switch the base to unexported mode given by $value, run $CODE, restore back the previous state and return the result of code ref.

log($level, $msg, $arg)

Log a message prefixed by database information

ReportChange($otype, $name, $ref, $changetype, $message, @args)

Functions to report back

list_supported_objects(@otype)

Return a list of supported object

@type is an additionnal list of objects to check

ListSubObjectOType($otype)

Return a list of sub object type supported by otype objects.

GetSubObjectKey($otype, $sotype)

Return the key linking sub object $sotype to object type $otype

ordered_objects

Return supported object type ordered in best order for synchronisation

is_supported_object($otype)

Return true is object type $otype is supported

list_objects($otype, %options)

Return the list of UID for object of $otype.

listRealObjects

Return the list of UID for object of $otype, alias objects are not return

Options depend of database support

get_object($type, $id)

Return an object of $type (typically user or group) having identifier $id.

create_c_object($type, $id, %data)

Create and return an object of type $type with unique id $id having %data using canonical fields

create_object($type, $id, %data)

Create and return an object of type $type with unique id $id having %data.

This method should be provided by the data base handler.

defaultAttributeValue($otype, $attr)

Return default static value for attribute $attr

compute_default($otype, $id, %cdata)

Return a hash containing value to set for new object

obj_attr_allowed_values ($otype, $attr)

Return value allowed for this attribute

check_allowed_values ($otype, $attr, $attrvalues)

Check attributes $attr of object type $otype allow values $attrvalues

obj_attr_param ( $otype, $attr, $param )

Return, if any, the paramater $param for this attribute from allowed_values config file

list_canonical_fields($otype, $for)

Return the list of supported fields by the database for object type $otype.

Optionnal $for specify the goal for which the list is requested, only supported fields will be returns

get_attr_schema

Deprecated

attribute($otype, $attribute)

Return attribute object.

See LATMOS::Accounts::Bases::Attribute

delayed_fields

DEPRECATED

ochelper ($otype)

Return LATMOS::Accounts::Bases::OChelper object

delete_object($otype, $id)

Destroy from data base object type $otype having id $id.

rename_object($otype, $id, $newid)

Rename an object.

is_transactionnal

Return True is the database support commit and rollback

commit

Save change into the database if change are not done immediately. This should always be called as you don't know when change are applied.

Return always true if database does not support any transaction.

The driver should provides a _commit functions to save data.

postcommit

Run postcommit command

rollback

If database support transaction, rollback changes. Return false if database does not support.

If supported, driver should provides a _rollback functions

current_rev

Return the current revision of the database

Must be provide by base driver if incremental synchro is supported

list_objects_from_rev($otype, $rev)

Return the list of UID for object of $otype.

sync_object_from($srcbase, $otype, $id, %options)

Sync object type $otype $id from base $srcbase to current base.

%options:

nodelete

Don't delete object if the object synchronize don't exist in source base

sync_object

Synchronise an object into this base

search_objects($otype, @filter)

Search object according @filter. @filter is a list of field/value which should match.

A default function is provided but each db driver can provide an optimize version.

attributes_summary($otype, $attr)

Return couple object id / value for attribute $attr of object type $otype

This method is designed to be faster than fetching object one by one.

attributes_summary_by_object($otype, $attr)

Return couple object id / value for attribute $attr of object type $otype

This method is designed to be faster than fetching object one by one.

fetchObjectInfo($otype, $attributes, @filters)

Return an hashref with attribute data for each object matching @filters.

If $attributes can be an array ref to a list of attributes.

find_next_numeric_id($otype, $field, $min, $max)

Return, if possible, next numeric id available (typically unix user UID).

authenticate_user($username, $passwd)

Return true if authentication success.

Must be override by driver if the base have a proper authentication method

passCrypt($clear_pass)

Return an encrypted password using method set in config

SetConnectedUser($username)

Set the username of the connected user

connect($username, $password)

Authenticate the user and store the username as connected

user

Return the current connected username

LogUser

Return the username to use when no user is connected

check_acl($obj, $attr, $perm)

Return true if connected user have $perm permission on attribute $attr of object $obj.

text_empty_dump($fh, $otype, $options)

Empty object dump

QFunc( $sub, @args )

Compute function given in queryformat/search

SEE ALSO

Top

AUTHOR

Top

Thauvin Olivier, <olivier.thauvin@latmos.ipsl.fr<gt>

COPYRIGHT AND LICENSE

Top