FusionDirectory
|
This class is made for easy plugin creation for editing LDAP attributes. More...
Public Member Functions | |
__construct (string $dn=NULL, $object=NULL, $parent=NULL, bool $mainTab=FALSE, array $attributesInfo=NULL) | |
constructor More... | |
setTemplate (bool $bool) | |
Sets whether the opened objet is a template. 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_category (string $category) | |
Set acl category. More... | |
move (string $src_dn, string $dst_dn) | |
Move ldap entries from one place to another. More... | |
getRequiredAttributes () | |
Returns list of required LDAP attributes. More... | |
readOnly () | |
Indicates if this object is opened as read-only (because of locks) | |
update () | |
Update state and return FALSE if the dialog was closed. | |
render () | |
This function display the plugin and return the html code. | |
show_header (string $buttonHtmlText, string $htmlText, bool $plugin_enabled, bool $button_disabled=FALSE, string $name='modify_state') | |
Show header message for tab dialogs. More... | |
isActive () | |
Test whether a tab is active. | |
isActivatable () | |
Test whether a tab can be deactivated. | |
attrIsReadable ($attr) | |
Check if logged in user have enough right to read this attribute value. More... | |
attrIsWriteable ($attr) | |
Check if logged in user have enough right to write this attribute value. More... | |
getAclBase (bool $callParent=TRUE) | |
Get LDAP base to use for ACL checks. | |
openDialog (FusionDirectoryDialog $dialog) | |
This function allows you to open a dialog. More... | |
closeDialog () | |
This function closes the dialog. | |
setNeedEditMode (bool $bool) | |
Sets whether the opened objet has an edit button. More... | |
acl_is_writeable ($attribute, bool $skipWrite=FALSE) | |
Can we write the attribute. | |
acl_is_readable ($attribute) | |
Can we read the acl. More... | |
acl_is_createable (string $base=NULL) | |
Can we create the object. More... | |
acl_is_removeable (string $base=NULL) | |
Can we delete the object. More... | |
acl_is_moveable (string $base=NULL) | |
Can we move the object. More... | |
aclHasPermissions () | |
Test if there are ACLs for this plugin. | |
aclGetPermissions ($attribute='0', string $base=NULL, bool $skipWrite=FALSE) | |
Get the acl permissions for an attribute or the plugin itself. | |
remove (bool $fulldelete=FALSE) | |
This function removes the object from LDAP. | |
save_object () | |
This function handle $_POST informations. | |
readPost () | |
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. | |
mergeObjectClasses (array $oc) | |
Merge in objectClasses needed by this tab. More... | |
handle_post_events (string $mode, array $addAttrs=[]) | |
Forward command execution requests to the post hook execution method. | |
handle_pre_events (string $mode, array $addAttrs=[]) | |
Forward command execution requests to the pre hook execution method. | |
fillHookAttrs (array &$addAttrs) | |
Fill attributes which may be used in hooks. More... | |
callHook ($cmd, array $addAttrs=[], &$returnOutput=[], &$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 (string $attribute, string $base) | |
Create unique DN. More... | |
adapt_from_template (array $attrs, array $skip=[]) | |
Adapt from template. More... | |
resetCopyInfos () | |
This function is called on the copied object to set its dn to where it will be saved. | |
deserializeValues (array $values, bool $checkAcl=TRUE) | |
Deserialize values. More... | |
showInTemplate (string $attr, array $templateAttrs) | |
Returns TRUE if this attribute should be asked in the creation by template dialog. More... | |
is_modal_dialog () | |
Is there a modal dialog opened. | |
Static Public Member Functions | |
static | plInfo () |
Return plugin informations for acl handling. More... | |
static | generatePlProvidedAcls (array $attributesInfo, bool $operationalAttributes=NULL) |
This function generate the needed ACLs for a given attribtues array. More... | |
static | mainInc ($classname=NULL, $entry_dn=NULL, $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 = [] | |
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 = [] | |
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... | |
getAuditAttributesListFromConf () | |
handle_hooks (string $when, string $mode, array $addAttrs=[]) | |
Forward command execution requests to the pre/post hook execution method. More... | |
Static Protected Member Functions | |
static | passwordProtect (string $hookCommand=NULL) |
This function protect the clear string password by replacing char. | |
Protected Attributes | |
$objectclasses = [] | |
The objectClasses set by this tab. | |
$saved_attributes = [] | |
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 = [] | |
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... | |
This class is made for easy plugin creation for editing LDAP attributes.
Definition at line 31 of file class_simplePlugin.inc.
__construct | ( | string | $dn = NULL , |
$object = NULL , |
|||
$parent = NULL , |
|||
bool | $mainTab = FALSE , |
||
array | $attributesInfo = NULL |
||
) |
constructor
string | $dn | The dn of this instance |
Object | $object | An object to copy values from |
Object | $parent | A parent instance, usually a simpleTabs instance. |
boolean | $mainTab | Whether or not this is the main tab |
array | $attributesInfo | An attributesInfo array, if NULL, getAttributesInfo will be used. |
Definition at line 155 of file class_simplePlugin.inc.
References $attributesInfo, $attrs, $dn, $mainTab, $parent, logging\debug(), session\get(), getEntryCSN(), in_array_ics(), session\is_set(), and setTemplate().
__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 437 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 474 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 458 of file class_simplePlugin.inc.
acl_is_createable | ( | string | $base = NULL | ) |
Can we create the object.
string | $base | Empty string |
Definition at line 1005 of file class_simplePlugin.inc.
References aclGetPermissions().
Referenced by get_allowed_bases(), and show_header().
acl_is_moveable | ( | string | $base = NULL | ) |
Can we move the object.
string | $base | Empty string |
Definition at line 1025 of file class_simplePlugin.inc.
References aclGetPermissions().
Referenced by attrIsWriteable(), and get_allowed_bases().
acl_is_readable | ( | $attribute | ) |
Can we read the acl.
string | $attribute |
Definition at line 995 of file class_simplePlugin.inc.
References aclGetPermissions().
Referenced by attrIsReadable(), and simpleService\getListEntry().
acl_is_removeable | ( | string | $base = NULL | ) |
Can we delete the object.
string | $base | Empty string |
Implements SimpleTab.
Definition at line 1015 of file class_simplePlugin.inc.
References aclGetPermissions().
Referenced by attrIsWriteable(), simpleService\getListEntry(), remove(), and show_header().
adapt_from_template | ( | array | $attrs, |
array | $skip = [] |
||
) |
Adapt from template.
Adapts fields to the values from a template. Should not empty any fields, only take values for the ones provided by the caller.
array | $attrs | LDAP attributes values for template-modified attributes |
array | $skip | attributes to leave untouched |
Implements SimpleTab.
Definition at line 2092 of file class_simplePlugin.inc.
attrIsReadable | ( | $attr | ) |
Check if logged in user have enough right to read this attribute value.
mixed | $attr | Attribute object or name (in this case it will be fetched from attributesAccess) |
Implements SimpleTab.
Definition at line 829 of file class_simplePlugin.inc.
References acl_is_readable().
attrIsWriteable | ( | $attr | ) |
Check if logged in user have enough right to write this attribute value.
mixed | $attr | Attribute object or name (in this case it will be fetched from attributesAccess) |
Implements SimpleTab.
Definition at line 847 of file class_simplePlugin.inc.
References acl_is_moveable(), acl_is_removeable(), and acl_is_writeable().
Referenced by deserializeValues().
create_unique_dn | ( | string | $attribute, |
string | $base | ||
) |
Create unique DN.
string | $attribute | |
string | $base |
Definition at line 2047 of file class_simplePlugin.inc.
References $dn.
deserializeValues | ( | array | $values, |
bool | $checkAcl = TRUE |
||
) |
Deserialize values.
Returns TRUE or error
Implements SimpleTab.
Definition at line 2177 of file class_simplePlugin.inc.
References attrIsWriteable(), htmlescape(), and msgPool\permModify().
fillHookAttrs | ( | array & | $addAttrs | ) |
Fill attributes which may be used in hooks.
Used by simplePlugin::callHook
Implements SimpleTab.
Definition at line 1619 of file class_simplePlugin.inc.
Referenced by callHook().
|
static |
This function generate the needed ACLs for a given attribtues array.
array | $attributesInfo | the attribute array |
bool? | $operationalAttributes Whether to add ACLs for operational attributes. Use NULL for autodetection (default) |
Definition at line 2272 of file class_simplePlugin.inc.
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
Definition at line 544 of file class_simplePlugin.inc.
References $dn, acl_is_createable(), and acl_is_moveable().
|
protected |
Definition at line 1506 of file class_simplePlugin.inc.
References class_available().
Referenced by post_save().
getRequiredAttributes | ( | ) |
Returns list of required LDAP attributes.
Used by template
Implements SimpleTab.
Definition at line 629 of file class_simplePlugin.inc.
|
protected |
Forward command execution requests to the pre/post hook execution method.
string | $when | must be PRE or POST |
string | $mode | add, remove or modify |
array | $addAttrs |
Definition at line 1568 of file class_simplePlugin.inc.
References callHook().
Referenced by handle_post_events(), and handle_pre_events().
|
static |
This function is the needed main.inc for plugins that are not used inside a management class.
array | $classname | the class name to read plInfo from. (plIcon, plTitle, plShortname and plObjectType may be used) |
string | $entry_dn | the dn of the object to show/edit |
boolean | $tabs | TRUE to use tabs, FALSE to show directly the plugin class |
boolean | $edit_mode | wether or not this plugin can be edited |
string | $objectType | The objectType to use (will be taken in the plInfo if FALSE) |
Definition at line 2308 of file class_simplePlugin.inc.
mergeObjectClasses | ( | array | $oc | ) |
Merge in objectClasses needed by this tab.
Used by prepare_save and template::apply
Implements SimpleTab.
Definition at line 1347 of file class_simplePlugin.inc.
References array_merge_unique(), handle_pre_events(), and htmlescape().
move | ( | string | $src_dn, |
string | $dst_dn | ||
) |
Move ldap entries from one place to another.
string | $src_dn | the source DN. |
string | $dst_dn | the destination DN. |
Definition at line 588 of file class_simplePlugin.inc.
References logging\debug(), DEBUG_LDAP, and logging\log().
openDialog | ( | FusionDirectoryDialog | $dialog | ) |
This function allows you to open a dialog.
FusionDirectoryDialog | $dialog | The dialog object |
Definition at line 962 of file class_simplePlugin.inc.
|
static |
Return plugin informations for acl handling.
Implements SimpleTab.
Definition at line 2261 of file class_simplePlugin.inc.
|
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 1471 of file class_simplePlugin.inc.
References getAuditAttributesListFromConf(), handle_post_events(), and logging\log().
set_acl_category | ( | string | $category | ) |
Set acl category.
string | $category |
Implements SimpleTab.
Definition at line 574 of file class_simplePlugin.inc.
setNeedEditMode | ( | bool | $needEditMode | ) |
Sets whether the opened objet has an edit button.
bool | $needEditMode |
Implements SimpleTab.
Definition at line 974 of file class_simplePlugin.inc.
References session\is_set().
setTemplate | ( | bool | $isTemplate | ) |
Sets whether the opened objet is a template.
bool | $isTemplate |
Implements SimpleTab.
Definition at line 360 of file class_simplePlugin.inc.
References templateHandling\fieldsFromLDAP(), and templateHandling\fieldsToLDAP().
Referenced by __construct().
show_header | ( | string | $buttonHtmlText, |
string | $htmlText, | ||
bool | $plugin_enabled, | ||
bool | $button_disabled = FALSE , |
||
string | $name = 'modify_state' |
||
) |
Show header message for tab dialogs.
string | $buttonHtmlText | The button text, escaped for HTML output |
string | $htmlText | The text to show, as HTML code |
boolean | $plugin_enabled | Is the plugin/tab activated |
boolean | $button_disabled | Is the button disabled |
string | $name | The html name of the input, defaults to modify_state |
Definition at line 796 of file class_simplePlugin.inc.
References acl_is_createable(), and acl_is_removeable().
showInTemplate | ( | string | $attr, |
array | $templateAttrs | ||
) |
Returns TRUE if this attribute should be asked in the creation by template dialog.
Implements SimpleTab.
Definition at line 2203 of file class_simplePlugin.inc.
$attributesAccess = [] |
This attribute store references toward attributes.
associative array that stores attributeLdapName => reference on object
Definition at line 40 of file class_simplePlugin.inc.
$attrs = [] |
Represent temporary LDAP data.
This should only be used internally.
Definition at line 93 of file class_simplePlugin.inc.
Referenced by __construct(), and is_modal_dialog().
|
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 142 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.
Definition at line 55 of file class_simplePlugin.inc.
$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 86 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.
Definition at line 77 of file class_simplePlugin.inc.
Referenced by simpleService\__construct(), and __construct().