gacl_api
gacl_api Extended API Class
Class gacl_api should be used for applications that must interface directly with phpGACL's data structures, objects, and rules.
Located in /phpgacl/gacl_api.php (line 53)
gacl gacl_api
Class | Description |
---|---|
JAuthorization | Class that handles all access authorization |
add_acl()
Add's an ACL. ACO_IDS, ARO_IDS, GROUP_IDS must all be arrays.
- array $aco_array: Associative array, item={Section Value}, key={Array of Object Values} i.e. ["<Section Value>" => ["<Value 1>", "<Value 2>", "<Value 3>"], ...]
- array $aro_array: Associative array, item={Section Value}, key={Array of Object Values} i.e. ["<Section Value>" => ["<Value 1>", "<Value 2>", "<Value 3>"], ...]
- array $aro_group_ids: Array of Group IDs
- array $axo_array: Associative array, item={Section Value}, key={Array of Object Values} i.e. ["<Section Value>" => ["<Value 1>", "<Value 2>", "<Value 3>"], ...]
- array $axo_group_ids: Array of Group IDs
- int $allow: Allow flag
- int $enabled: Enabled flag
- string $return_value: Return Value
- string $note: Note
- string $section_value: ACL Section Value
- int $acl_id: ACL ID # Specific Request
add_group()
Inserts a group, defaults to be on the "root" branch.
Since v3.3.x you can only create one group with Parent_ID=0 So, its a good idea to create a "Virtual Root" group with Parent_ID=0 Then assign other groups to that.
- string $value: Group Value
- string $name: Group Name
- int $parent_id: Parent Group ID #
- string $group_type: Group Type, either 'ARO' or 'AXO'
add_group_object()
Assigns an Object to a group
- int $group_id: Group ID #
- string $object_section_value: Object Section Value
- string $object_value: Object Value
- string $group_type: Group Type, either 'ARO' or 'AXO'
add_object()
Inserts a new object
- string $section_value: Object Section Value
- string $name: Object Name
- string $value: Object Value
- int $order: Display Order
- int $hidden: Hidden Flag, either 1 to hide, or 0 to show.
- string $object_type: Object Type, either 'ACO', 'ARO', or 'AXO'
add_object_section()
Inserts an object Section
- string $name: Object Name
- string $value: Object Value
- int $order: Display Order
- int $hidden: Hidden flag, hides section if 1, shows section if 0
- string $object_type: Object Type, either 'ACO', 'ARO', 'AXO', or 'ACL'
append_acl()
Appends objects on to a specific ACL.
- int $acl_id: ACL ID #
- array $aro_array: Associative array, item={Section Value}, key={Array of Object Values} i.e. ["<Section Value>" => ["<Value 1>", "<Value 2>", "<Value 3>"], ...]
- array $aro_group_ids: Array of Group IDs
- array $axo_array: Associative array, item={Section Value}, key={Array of Object Values} i.e. ["<Section Value>" => ["<Value 1>", "<Value 2>", "<Value 3>"], ...]
- array $axo_group_ids: Array of Group IDs
- array $aco_array: Associative array, item={Section Value}, key={Array of Object Values} i.e. ["<Section Value>" => ["<Value 1>", "<Value 2>", "<Value 3>"], ...]
clear_database()
Deletes all data from the phpGACL tables. USE WITH CAUTION.
consolidated_edit_acl()
Add's an ACL but checks to see if it can consolidate it with another one first.
This ONLY works with ACO's and ARO's. Groups, and AXO are excluded. As well this function is designed for handling ACLs with return values, and consolidating on the return_value, in hopes of keeping the ACL count to a minimum.
A return value of false must _always_ be handled outside this function. As this function will remove AROs from ACLs and return false, in most cases you will need to a create a completely new ACL on a false return.
- string $aco_section_value: ACO Section Value
- string $aco_value: ACO Value
- string $aro_section_value: ARO Section Value
- string $aro_value: ARO Value
- string $return_value: Return Value of ACL
count_all()
Recursively counts elements in an array and sub-arrays.
This is different from count($arg, COUNT_RECURSIVE) in PHP >= 4.2.0, which includes sub-arrays in the count.
- array $arg: Array to count
del_acl()
Deletes a given ACL
- int $acl_id: ACL ID # to delete
del_group()
deletes a given group
- int $group_id: Group ID #
- bool $reparent_children: If TRUE, child groups of this group will be reparented to the current group's parent.
- string $group_type: Group Type, either 'ARO' or 'AXO'
del_group_object()
Removes an Object from a group.
- int $group_id: Group ID #
- string $object_section_value: Object Section Value
- string $object_value: Object Value
- string $group_type: Group Type, either 'ARO' or 'AXO'
del_object()
Deletes a given Object and, if instructed to do so, erase all referencing objects
ERASE feature by: Martino Piccinato
- int $object_id: Object ID #
- string $object_type: Object Type, either 'ACO', 'ARO', or 'AXO'
- bool $erase: Erases all referencing objects if TRUE, leaves them alone otherwise.
del_object_section()
Deletes a given Object Section and, if explicitly asked, all the section objects
ERASE feature by: Martino Piccinato
- int $object_section_id: Object Section ID # to delete
- string $object_type: Object Type, either 'ACO', 'ARO', 'AXO', or 'ACL'
- bool $erase: Erases all section objects assigned to the section
edit_acl()
Edit's an ACL, ACO_IDS, ARO_IDS, GROUP_IDS must all be arrays.
- int $acl_id: ACL ID # to edit
- array $aco_array: Associative array, item={Section Value}, key={Array of Object Values} i.e. ["<Section Value>" => ["<Value 1>", "<Value 2>", "<Value 3>"], ...]
- array $aro_array: Associative array, item={Section Value}, key={Array of Object Values} i.e. ["<Section Value>" => ["<Value 1>", "<Value 2>", "<Value 3>"], ...]
- array $aro_group_ids: Array of Group IDs
- array $axo_array: Associative array, item={Section Value}, key={Array of Object Values} i.e. ["<Section Value>" => ["<Value 1>", "<Value 2>", "<Value 3>"], ...]
- array $axo_group_ids: Array of Group IDs
- int $allow: Allow flag
- int $enabled: Enabled flag
- string $return_value: Return Value
- string $note: Note
- string $section_value: ACL Section Value
edit_group()
Edits a group
- int $group_id: Group ID #
- string $value: Group Value
- string $name: Group Name
- int $parent_id: Parent ID #
- string $group_type: Group Type, either 'ARO' or 'AXO'
edit_object()
Edits a given Object
- int $object_id: Object ID #
- string $section_value: Object Section Value
- string $name: Object Name
- string $value: Object Value
- int $order: Display Order
- int $hidden: Hidden Flag, either 1 to hide, or 0 to show
- string $object_type: Object Type, either 'ACO', 'ARO', or 'AXO'
edit_object_section()
Edits a given Object Section
- int $object_section_id: Object Section ID #
- string $name: Object Section Name
- string $value: Object Section Value
- int $order: Display Order
- int $hidden: Hidden Flag, hide object section if 1, show if 0
- string $object_type: Object Type, either 'ACO', 'ARO', 'AXO', or 'ACL'
format_groups()
Takes the array returned by sort_groups() and formats for human consumption. Recursively calls itself to produce the desired output.
- array $sorted_groups: Output from gacl_api->sorted_groups($group_type)
- array $type: Output type desired, either 'TEXT', 'TEXT_ASSOC', 'HTML', 'ARRAY' or 'ASSOC'
- int $root_id: Root of tree to produce
- int $level: Current level of depth
- array $formatted_groups: Pass the current formatted groups object for appending via recursion.
get_group_children()
Gets a groups child IDs
- int $group_id: Group ID #
- int $group_type: Group Type, either 'ARO' or 'AXO'
- string $recurse: Either 'RECURSE' or 'NO_RECURSE', to recurse while fetching group children.
get_group_data()
Gets the group data given the GROUP_ID.
- int $group_id: Group ID #
- string $group_type: Group Type, either 'ARO' or 'AXO'
get_group_id()
Gets the group_id given the name or value.
Will only return one group id, so if there are duplicate names, it will return false.
- string 2: Group Type, either 'ARO' or 'AXO'
- string $name: Group Value
- string $group_type: Group Name
get_group_objects()
Gets all objects assigned to a group.
If $option == 'RECURSE' it will get all objects in child groups as well. defaults to omit child groups.
- int $group_id: Group ID #
- string $group_type: Group Type, either 'ARO' or 'AXO'
- string $option: Option, either 'RECURSE' or 'NO_RECURSE'
get_group_parent_id()
Grabs the parent_id of a given group
- int $id: Group ID #
- string $group_type: Group Type, either 'ARO' or 'AXO'
get_object()
Grabs all Objects's in the database, or specific to a section_value
- string $section_value: Filter to this section value
- int $return_hidden: Returns hidden objects if 1, leaves them out otherwise.
- string $object_type: Object Type, either 'ACO', 'ARO', 'AXO', or 'ACL'
get_objects ()
Grabs all Objects in the database, or specific to a section_value
- string $section_value: Filter for section value
- int $return_hidden: Returns hidden objects if 1, does not if 0
- string $object_type: Object Type, either 'ACO', 'ARO', 'AXO'
get_object_data()
Gets all data pertaining to a specific Object.
- int $object_id: Object ID #
- string $object_type: Object Type, either 'ACO', 'ARO', 'AXO'
get_object_groups()
Gets all groups an object is a member of.
If $option == 'RECURSE' it will get all ancestor groups. defaults to only get direct parents.
- int $object_id: Object ID #
- string $object_type: Object Type, either 'ARO' or 'AXO'
- string $option: Option, either 'RECURSE', or 'NO_RECURSE'
get_object_id()
Gets the object_id given the section_value AND value of the object.
- string $section_value: Object Section Value
- string $value: Object Value
- string $object_type: Object Type, either 'ACO', 'ARO', 'AXO'
get_object_section_section_id()
Gets the object_section_id given the name AND/OR value of the section.
Will only return one section id, so if there are duplicate names it will return false.
- string $name: Object Name
- string $value: Object Value
- string $object_type: Object Type, either 'ACO', 'ARO', 'AXO', or 'ACL'
get_object_section_value()
Gets the object_section_value given object id
- int $object_id: Object ID #
- string $object_type: Object Type, either 'ACO', 'ARO', or 'AXO'
get_root_group_id ()
Grabs the id of the root group for the specified tree
- string $group_type: Group Type, either 'ARO' or 'AXO'
get_schema_version()
Grabs phpGACL schema version from the database.
get_ungrouped_objects()
Grabs ID's of all Objects (ARO's and AXO's only) in the database not assigned to a Group.
This function is useful for applications that synchronize user databases with an outside source. If syncrhonization doesn't automatically place users in an appropriate group, this function can quickly identify them so that they can be assigned to the correct group.
- int $return_hidden: Returns hidden objects if 1, does not if 0.
- string $object_type: Object Type, either 'ARO' or 'AXO' (groupable types)
is_conflicting_acl()
Checks for conflicts when adding a specific ACL.
- array $aco_array: Associative array, item={Section Value}, key={Array of Object Values} i.e. ["<Section Value>" => ["<Value 1>", "<Value 2>", "<Value 3>"], ...]
- array $aro_array: Associative array, item={Section Value}, key={Array of Object Values} i.e. ["<Section Value>" => ["<Value 1>", "<Value 2>", "<Value 3>"], ...]
- array $aro_group_ids: Array of Group IDs
- array $axo_array: Associative array, item={Section Value}, key={Array of Object Values} i.e. ["<Section Value>" => ["<Value 1>", "<Value 2>", "<Value 3>"], ...]
- array $axo_group_ids: Array of Group IDs
- array $ignore_acl_ids: Array of ACL IDs to ignore from the result set.
rebuild_tree ()
rebuilds the group tree for the given type
- string $group_type: Group Type, either 'ARO' or 'AXO'
- int $group_id: Group ID #
- int $left: Left value of Group
search_acl()
Searches for ACL's with specified objects mapped to them.
NULL values are included in the search, if you want to ignore for instance aro_groups use FALSE instead of NULL.
- string $aco_section_value: ACO Section Value
- string $aco_value: ACO Value
- string $aro_section_value: ARO Section Value
- string $aro_value: ARO Value
- string $aro_group_name: ARO Group Name
- string $axo_section_value: AXO Section Value
- string $axo_value: AXO Value
- string $axo_group_name: AXO Group Name
- string $return_value: Return Value
shift_acl()
Opposite of append_acl(). Removes objects from a specific ACL. (named after PHP's array_shift())
- int $acl_id: ACL ID #
- array $aro_array: Associative array, item={Section Value}, key={Array of Object Values} i.e. ["<Section Value>" => ["<Value 1>", "<Value 2>", "<Value 3>"], ...]
- array $aro_group_ids: Array of Group IDs
- array $axo_array: Associative array, item={Section Value}, key={Array of Object Values} i.e. ["<Section Value>" => ["<Value 1>", "<Value 2>", "<Value 3>"], ...]
- array $axo_group_ids: Array of Group IDs
- array $aco_array: Associative array, item={Section Value}, key={Array of Object Values} i.e. ["<Section Value>" => ["<Value 1>", "<Value 2>", "<Value 3>"], ...]
showarray()
Dump all contents of an array in HTML (kinda)
- array $array
sort_groups()
Grabs all the groups from the database doing preliminary grouping by parent
- string $group_type: Group Type, either 'ARO' or 'AXO'
Calculates the start number for a sequence table
- string $table: The name of the table
_rebuild_tree ()
Utility recursive function called by rebuild_tree()
- string $table: Table name of group type
- int $group_id: Group ID #
- int $left: Left value of Group
Inherited Methods
Inherited From gacl
gacl::gacl()
gacl::acl_check()
gacl::acl_check_array()
gacl::acl_get_groups()
gacl::acl_query()
gacl::acl_return_value()
gacl::debug_db()
gacl::debug_text()
gacl::get_cache()
gacl::put_cache()
Documentation generated on Mon, 05 Mar 2007 21:04:03 +0000 by phpDocumentor 1.3.1