LATMOS::Accounts::Bases - Base class for account data bases
use LATMOS::Accounts::Bases; my $base = LATMOS::Accounts::Bases->new('type', %options); ...
This module provide basic functions for various account base
Return, if success, a new data base account object, $type is account base type, %options to setup the base.
Set callbalc $<cb> to function $code
.
Set callback $<cb> to function $code
.
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.
Return the database label
Return the type of the base
return LATMOS::Accounts object parent to the base
Return options from config
See unexported
Set base to report unexported object or not
Switch the base to unexported mode given by $value
, run $CODE
, restore
back the previous state and return the result of code ref.
Log a message prefixed by database information
Functions to report back
Return a list of supported object
@type is an additionnal list of objects to check
Return a list of sub object type supported by otype
objects.
Return the key linking sub object $sotype
to object type $otype
Return supported object type ordered in best order for synchronisation
Return true is object type $otype is supported
Return the list of UID for object of $otype.
Return the list of UID for object of $otype, alias objects are not return
Options depend of database support
Return an object of $type (typically user or group) having identifier $id.
Create and return an object of type $type with unique id $id having %data using canonical fields
Create and return an object of type $type with unique id $id having %data.
This method should be provided by the data base handler.
Return default static value for attribute $attr
Return a hash containing value to set for new object
Return value allowed for this attribute
Check attributes $attr
of object type $otype
allow values $attrvalues
Return, if any, the paramater $param for this attribute from allowed_values config file
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
Deprecated
Return attribute object.
DEPRECATED
Return LATMOS::Accounts::Bases::OChelper object
Destroy from data base object type $otype having id $id.
Rename an object.
Return True is the database support commit and rollback
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.
Run postcommit command
If database support transaction, rollback changes. Return false if database does not support.
If supported, driver should provides a _rollback functions
Return the current revision of the database
Must be provide by base driver if incremental synchro is supported
Return the list of UID for object of $otype.
Sync object type $otype
$id
from base $srcbase
to current base.
%options
:
Don't delete object if the object synchronize don't exist in source base
Synchronise an object into this base
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.
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.
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.
Return an hashref with attribute data for each object matching @filters.
If $attributes
can be an array ref to a list of attributes.
Return, if possible, next numeric id available (typically unix user UID).
Return true if authentication success.
Must be override by driver if the base have a proper authentication method
Return an encrypted password using method set in config
Set the username of the connected user
Authenticate the user and store the username as connected
Return the current connected username
Return the username to use when no user is connected
Return true if connected user have $perm
permission on attribute $attr
of
object $obj
.
Empty object dump
Compute function given in queryformat/search
Thauvin Olivier, <olivier.thauvin@latmos.ipsl.fr<gt>
Copyright (C) 2009 by Thauvin Olivier
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.