FusionDirectory
 All Data Structures Files Functions Variables
Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
simplePlugin Class Reference

This class is made for easy plugin creation for editing LDAP attributes. More...

Inheritance diagram for simplePlugin:
Inheritance graph
[legend]

Public Member Functions

 __construct ($dn=NULL, $object=NULL, $parent=NULL, $mainTab=FALSE, $attributesInfo=NULL)
 constructor More...
 
 getObjectClassFilter ()
 This function returns an LDAP filter for this plugin object classes.
 
 __get ($name)
 This function allows to use the syntax $plugin->attributeName to get attributes values. More...
 
 __set ($name, $value)
 This function allows to use the syntax $plugin->attributeName to set attributes values. More...
 
 __isset ($name)
 This function allows to use the syntax isset($plugin->attributeName) More...
 
 compute_dn ()
 This function returns the dn this object should have.
 
 get_allowed_bases ()
 Returns a list of all available departments for this object. More...
 
 set_acl_base ($base)
 Set acl base. More...
 
 set_acl_category ($category)
 Set acl category. More...
 
 move ($src_dn, $dst_dn)
 Move ldap entries from one place to another. More...
 
 readOnly ()
 Indicates if this object is opened as read-only (because of locks)
 
 execute ()
 This function display the plugin and return the html code.
 
 show_header ($button_text, $text, $plugin_enabled, $button_disabled=FALSE, $name= 'modify_state')
 Show header message for tab dialogs. More...
 
 attrIsWriteable ($attr)
 Check if logged in user have enough right to write this attribute value. More...
 
 openDialog ($dialog)
 This function allows you to open a dialog. More...
 
 closeDialog ()
 This function closes the dialog.
 
 acl_is_writeable ($attribute, $skipWrite=FALSE)
 Can we write the attribute.
 
 acl_is_readable ($attribute)
 Can we read the acl. More...
 
 acl_is_createable ($base=NULL)
 Can we create the object. More...
 
 acl_is_removeable ($base=NULL)
 Can we delete the object. More...
 
 acl_is_moveable ($base=NULL)
 Can we move the object. More...
 
 aclGetPermissions ($attribute= '0', $base=NULL, $skipWrite=FALSE)
 Get the acl permissions for an attribute or the plugin itself.
 
 remove_from_parent ()
 This function removes the object from LDAP.
 
 save_object ()
 This function handle $_POST informations.
 
 cleanup ()
 Remove attributes, empty arrays, arrays single attributes that do not differ.
 
 save ()
 This function saves the object in the LDAP.
 
 handle_post_events ($mode, array $addAttrs=array())
 Forward command execution requests to the post hook execution method.
 
 handle_pre_events ($mode, array $addAttrs=array())
 Forward command execution requests to the pre hook execution method.
 
 callHook ($cmd, array $addAttrs=array(), &$returnOutput=array(), &$returnCode=NULL)
 Calls external hooks which are defined for this plugin (fusiondirectory.conf) Replaces placeholder by class values of this plugin instance. Allows to a add special replacements.
 
 check ()
 This function checks the attributes values and yell if something is wrong.
 
 create_unique_dn ($attribute, $base)
 Create unique DN. More...
 
 resetCopyInfos ()
 This function is called on the copied object to set its dn to where it will be saved.
 

Static Public Member Functions

static plInfo ()
 Return plugin informations for acl handling. More...
 
static generatePlProvidedAcls ($attributesInfo)
 This function generate the needed ACLs for a given attribtues array. More...
 
static mainInc ($classname, $entry_dn, $tabs=FALSE, $edit_mode=TRUE, $objectType=FALSE)
 This function is the needed main.inc for plugins that are not used inside a management class. More...
 

Data Fields

 $attributesInfo
 This attribute store all information about attributes.
 
 $attributesAccess = array()
 This attribute store references toward attributes. More...
 
 $is_account = FALSE
 Mark plugin as account. More...
 
 $dn = ''
 dn of the opened object
 
 $orig_dn = ''
 original dn of the opened object
 
 $parent = NULL
 Reference to parent object. More...
 
 $is_template = FALSE
 Mark plugin as template. More...
 
 $attrs = array()
 Represent temporary LDAP data. More...
 

Protected Member Functions

 post_save ()
 This function is called after LDAP save to do some post operations and logging. More...
 
 handle_hooks ($when, $mode, array $addAttrs=array())
 Forward command execution requests to the pre/post hook execution method. More...
 

Protected Attributes

 $objectclasses = array()
 The objectClasses set by this tab.
 
 $saved_attributes = array()
 The state of the attributes when we opened the object.
 
 $displayHeader = FALSE
 Do we want a header allowing to able/disable this plugin.
 
 $mainTab = FALSE
 Is this plugin the main tab, the one that handle the object itself.
 
 $needEditMode = FALSE
 Are we executed in a edit-mode environment? (this is FALSE if we're called from management, TRUE if we're called from a main.inc)
 
 $preInitAttributes = array()
 Attributes that needs to be initialized before the others.
 
 $inheritance = FALSE
 FALSE to disable inheritance. Array like array ('objectClass' => 'attribute') to specify oc of the groups it might be inherited from.
 
 $read_only = FALSE
 Used when the entry is opened as "readonly" due to locks.
 
 $ldap_error
 Last LDAP error (used by logging calls from post_* methods)
 
 $entryCSN = ''
 Object entry CSN. More...
 

Detailed Description

This class is made for easy plugin creation for editing LDAP attributes.

Definition at line 29 of file class_simplePlugin.inc.

Constructor & Destructor Documentation

__construct (   $dn = NULL,
  $object = NULL,
  $parent = NULL,
  $mainTab = FALSE,
  $attributesInfo = NULL 
)

constructor

Parameters
string$dnThe dn of this instance
Object$objectAn object to copy values from
Object$parentA parent instance, usually a simpleTabs instance.
boolean$mainTabWhether or not this is the main tab
array$attributesInfoAn attributesInfo array, if NULL, getAttributesInfo will be used.

Definition at line 148 of file class_simplePlugin.inc.

References $attributesInfo, $attrs, $dn, $is_account, $mainTab, $parent, DEBUG(), session\get(), get_template_path(), getEntryCSN(), getObjectClassFilter(), session\global_is_set(), and in_array_ics().

Member Function Documentation

__get (   $name)

This function allows to use the syntax $plugin->attributeName to get attributes values.

It calls the getValue method on the concerned attribute It also adds the $plugin->attribtues syntax to get attributes list

Definition at line 414 of file class_simplePlugin.inc.

__isset (   $name)

This function allows to use the syntax isset($plugin->attributeName)

It returns FALSE if the attribute has an empty value.

Definition at line 452 of file class_simplePlugin.inc.

__set (   $name,
  $value 
)

This function allows to use the syntax $plugin->attributeName to set attributes values.

It calls the setValue method on the concerned attribute

Definition at line 436 of file class_simplePlugin.inc.

acl_is_createable (   $base = NULL)

Can we create the object.

Parameters
string$baseEmpty string

Definition at line 926 of file class_simplePlugin.inc.

References aclGetPermissions().

Referenced by get_allowed_bases(), save_object(), and show_header().

acl_is_moveable (   $base = NULL)

Can we move the object.

Parameters
string$baseEmpty string

Definition at line 946 of file class_simplePlugin.inc.

References aclGetPermissions().

Referenced by attrIsWriteable(), and get_allowed_bases().

acl_is_readable (   $attribute)

Can we read the acl.

Parameters
string$attribute

Definition at line 916 of file class_simplePlugin.inc.

References aclGetPermissions().

Referenced by simpleService\getListEntry().

acl_is_removeable (   $base = NULL)

Can we delete the object.

Parameters
string$baseEmpty string

Definition at line 936 of file class_simplePlugin.inc.

References aclGetPermissions().

Referenced by attrIsWriteable(), simpleService\getListEntry(), remove_from_parent(), save_object(), and show_header().

attrIsWriteable (   $attr)

Check if logged in user have enough right to write this attribute value.

Parameters
mixed$attrAttribute object or name (in this case it will be fetched from attributesAccess)

Definition at line 792 of file class_simplePlugin.inc.

References acl_is_moveable(), acl_is_removeable(), and acl_is_writeable().

Referenced by save_object().

create_unique_dn (   $attribute,
  $base 
)

Create unique DN.

Parameters
string$attribute
string$base

Definition at line 1726 of file class_simplePlugin.inc.

References $attrs, and $dn.

static generatePlProvidedAcls (   $attributesInfo)
static

This function generate the needed ACLs for a given attribtues array.

Parameters
array$attributesInfothe attribute array

Definition at line 1882 of file class_simplePlugin.inc.

References $attributesInfo.

get_allowed_bases ( )

Returns a list of all available departments for this object.

If this object is new, all departments we are allowed to create a new object in are returned. If this is an existing object, return all deps we are allowed to move this object to. Used by BaseSelectorAttribute

Returns
array [dn] => "..name" // All deps. we are allowed to act on.

Definition at line 530 of file class_simplePlugin.inc.

References $dn, acl_is_createable(), and acl_is_moveable().

handle_hooks (   $when,
  $mode,
array  $addAttrs = array() 
)
protected

Forward command execution requests to the pre/post hook execution method.

Parameters
string$whenmust be PRE or POST
string$modeadd, remove or modify
array$addAttrs

Definition at line 1356 of file class_simplePlugin.inc.

References callHook().

Referenced by handle_post_events(), and handle_pre_events().

static mainInc (   $classname,
  $entry_dn,
  $tabs = FALSE,
  $edit_mode = TRUE,
  $objectType = FALSE 
)
static

This function is the needed main.inc for plugins that are not used inside a management class.

Parameters
array$classnamethe class name to read plInfo from. (plIcon, plShortname and plCategory are gonna be used)
string$entry_dnthe dn of the object to show/edit
boolean$tabsTRUE to use tabs, FALSE to show directly the plugin class
boolean$edit_modewether or not this plugin can be edited
string$objectTypeThe objectType to use (will be taken in the plInfo if FALSE)

Definition at line 1910 of file class_simplePlugin.inc.

References add_lock(), msgPool\clickEditToChange(), del_lock(), gen_locked_message(), session\get(), get_locks(), get_template_path(), session\is_set(), objects\open(), print_header(), session\set(), and session\un_set().

move (   $src_dn,
  $dst_dn 
)

Move ldap entries from one place to another.

Parameters
string$src_dnthe source DN.
string$dst_dnthe destination DN.
Returns
TRUE on success, error string on failure

Definition at line 582 of file class_simplePlugin.inc.

References DEBUG(), DEBUG_LDAP, and logging\log().

openDialog (   $dialog)

This function allows you to open a dialog.

Parameters
mixed$dialogThe dialog object

Definition at line 883 of file class_simplePlugin.inc.

static plInfo ( )
static

Return plugin informations for acl handling.

Returns
an array

Definition at line 1873 of file class_simplePlugin.inc.

post_save ( )
protected

This function is called after LDAP save to do some post operations and logging.

This function calls hooks, update foreign keys and log modification

Definition at line 1332 of file class_simplePlugin.inc.

References handle_post_events(), and logging\log().

Referenced by save().

set_acl_base (   $base)

Set acl base.

Parameters
string$base

Definition at line 558 of file class_simplePlugin.inc.

set_acl_category (   $category)

Set acl category.

Parameters
string$category

Definition at line 568 of file class_simplePlugin.inc.

show_header (   $button_text,
  $text,
  $plugin_enabled,
  $button_disabled = FALSE,
  $name = 'modify_state' 
)

Show header message for tab dialogs.

Parameters
string$button_textThe button text
string$textThe text
boolean$plugin_enabled
boolean$button_disabledFALSE

Definition at line 775 of file class_simplePlugin.inc.

References acl_is_createable(), and acl_is_removeable().

Referenced by execute().

Field Documentation

$attributesAccess = array()

This attribute store references toward attributes.

associative array that stores attributeLdapName => reference on object

Definition at line 38 of file class_simplePlugin.inc.

$attrs = array()

Represent temporary LDAP data.

This should only be used internally.

Definition at line 90 of file class_simplePlugin.inc.

Referenced by __construct(), create_unique_dn(), and save_object().

$entryCSN = ''
protected

Object entry CSN.

If an entry was edited while we have edited the entry too, an error message will be shown. To configure this check correctly read the FAQ.

Definition at line 137 of file class_simplePlugin.inc.

$is_account = FALSE

Mark plugin as account.

Defines whether this plugin is defined as an account or not. This has consequences for the plugin to be saved from tab mode. If it is set to 'FALSE' the tab will call the delete function, else the save function. Should be set to 'TRUE' if the construtor detects a valid LDAP object.

See also
simplePlugin::is_this_account()

Definition at line 51 of file class_simplePlugin.inc.

Referenced by __construct().

$is_template = FALSE

Mark plugin as template.

Defines whether we are editing a template or a normal object. Has consequences on the way execute() shows the formular and how save() puts the data to LDAP.

Definition at line 83 of file class_simplePlugin.inc.

$parent = NULL

Reference to parent object.

This variable is used when the plugin is included in tabs and keeps reference to the tab class. Communication to other tabs is possible by 'name'. So the 'fax' plugin can ask the 'userinfo' plugin for the fax number.

See also
simpleTabs

Definition at line 74 of file class_simplePlugin.inc.

Referenced by simpleService\__construct(), and __construct().


The documentation for this class was generated from the following file: