Developers
Here you can find useful information about how to use the API class of AceACL.
FAQ
How to show the Permissions Widget into my component?
That is pretty simple, you can display and save the permissions by adding just a couple of lines. You should customize just the com_kunena.category.5 part.Display Permissions Widget
$defined_constants = get_defined_constants();
if (!empty($defined_constants['ACEACL']) && AceaclApi::authorize('permissions', 'com_aceacl')) {
AceaclApi::getWidget('com_kunena.category.5', true);
}
if (!empty($defined_constants['ACEACL']) && AceaclApi::authorize('permissions', 'com_aceacl')) {
AceaclApi::getWidget('com_kunena.category.5', true);
}
Save Permissions Widget
$defined_constants = get_defined_constants();
if (!empty($defined_constants['ACEACL']) && AceaclApi::authorize('permissions', 'com_aceacl')) {
AceaclApi::storeWidget('com_kunena.category.5', true);
}
if (!empty($defined_constants['ACEACL']) && AceaclApi::authorize('permissions', 'com_aceacl')) {
AceaclApi::storeWidget('com_kunena.category.5', true);
}
API
AceACL API class
Name: AceaclApi
Type: Abstract
Since: 1.5.2
Location: administrator/components/com_aceacl/library/api.php
Type: Abstract
Since: 1.5.2
Location: administrator/components/com_aceacl/library/api.php
Method Summary
boolean authorize ([string $action = ''], [string $name = ''], [int $user_id = null])
object getConfig ()
object storeConfig ([object $config = ''])
objectList getRules ([string $name = ''])
boolean storeRules ([string $title = ''],[string $name = ''], [string $action = ''], [int $client = ''], [string $params = null])
boolean loadACL ([string $option = false], [string $type = 'group'])
string(json) getACL ([string $name = ''], [string $type = 'group'])
void setACL ([string $name = ''], [string (json) $actions = ''], [string $type = 'group'])
object getPermissions ([string $name = ''], [int $client = ''], [string $type = ''])
boolean storePermissions ([string $name = ''], [string $action = ''], [int $client = ''], [int $state = ''], [int $id = null], [string $type = 'group'])
void getWidget ([string $name = ''], [boolean $is_not_slider = false])
void storeWidget ([string $name = ''])
objectList getUsersByGroup ([int $group_id = ''])
objectList getGroupsByUser ([int $user_id = null])
string getGroupName ([int $id = ''])
int getGroupID ([string $name = ''])
boolean addUserToMultiGroup ([int $group_id = ''], [int $user_id = null])
boolean removeUserFromMultiGroup ([int $group_id = ''], [int $user_id = null])
object getExtension ([string $option = ''])
object getConfig ()
object storeConfig ([object $config = ''])
objectList getRules ([string $name = ''])
boolean storeRules ([string $title = ''],[string $name = ''], [string $action = ''], [int $client = ''], [string $params = null])
boolean loadACL ([string $option = false], [string $type = 'group'])
string(json) getACL ([string $name = ''], [string $type = 'group'])
void setACL ([string $name = ''], [string (json) $actions = ''], [string $type = 'group'])
object getPermissions ([string $name = ''], [int $client = ''], [string $type = ''])
boolean storePermissions ([string $name = ''], [string $action = ''], [int $client = ''], [int $state = ''], [int $id = null], [string $type = 'group'])
void getWidget ([string $name = ''], [boolean $is_not_slider = false])
void storeWidget ([string $name = ''])
objectList getUsersByGroup ([int $group_id = ''])
objectList getGroupsByUser ([int $user_id = null])
string getGroupName ([int $id = ''])
int getGroupID ([string $name = ''])
boolean addUserToMultiGroup ([int $group_id = ''], [int $user_id = null])
boolean removeUserFromMultiGroup ([int $group_id = ''], [int $user_id = null])
object getExtension ([string $option = ''])
Methods
authorize ($action, $name, $user_id = null)
Check if the visitor/user is authorized or not. Returns boolean value.
string $action : Action name like edit, move, manage etc.
string $name : Permission name like "com_content", "com_content.category.1" or "com_content.item.1".
int $user_id : The user identifier, if the user ID is null then the logged user ID is used
Check if the visitor/user is authorized or not. Returns boolean value.
string $action : Action name like edit, move, manage etc.
string $name : Permission name like "com_content", "com_content.category.1" or "com_content.item.1".
int $user_id : The user identifier, if the user ID is null then the logged user ID is used
getConfig ()
Get AceACL configuration object (stdClass). Returns an AceACL configuration object, only once created.
Get AceACL configuration object (stdClass). Returns an AceACL configuration object, only once created.
storeConfig ($config)
Store AceACL configuration object (stdClass). Returns void value.
object $config :An object of configuration settings.
Store AceACL configuration object (stdClass). Returns void value.
object $config :An object of configuration settings.
getRules ($name)
Get rules from database acording to name. Returns ofjectList value.
string $name : Name of rule.
Get rules from database acording to name. Returns ofjectList value.
string $name : Name of rule.
storeRules ($title, $name, $action, $client, $params = null)
Store any rule to database.
string $title : Title of the rule
string $name : Name of the rule. Must be like (global / com_foo / com_foo.category.cat_id / com_foo.item.item_id)
string $action : Action like edit, move, manage etc.
string $client : Client must be 0=front-end, 1=back-end or 2=both
string $params :
Store any rule to database.
string $title : Title of the rule
string $name : Name of the rule. Must be like (global / com_foo / com_foo.category.cat_id / com_foo.item.item_id)
string $action : Action like edit, move, manage etc.
string $client : Client must be 0=front-end, 1=back-end or 2=both
string $params :
loadACL ($option = false, $type = 'group')
Load the permissions from AceACL DB tables to RAM (static var). Returns boolean value.
string $option : Component name like "com_content"
string $type : Type must be "group" or "user"
Load the permissions from AceACL DB tables to RAM (static var). Returns boolean value.
string $option : Component name like "com_content"
string $type : Type must be "group" or "user"
getACL ($name, $actions, $type = 'group')
Get the permissions loaded to RAM (static var). Returns JSON string value.
string $name : Permission name.
string $type : Type must be "group" or "user"
Get the permissions loaded to RAM (static var). Returns JSON string value.
string $name : Permission name.
string $type : Type must be "group" or "user"
setACL ($name, $actions, $type = 'group')
Set specific permission to RAM (static var). Returns void.
string $name : Permission name.
string $actions : Permission actions.
string $type : Type must be "group" or "user"
Set specific permission to RAM (static var). Returns void.
string $name : Permission name.
string $actions : Permission actions.
string $type : Type must be "group" or "user"
getPermissions ($name, $client, $type)
Get permissions from database acording to name, client and type. Returns object value.
string $name : Permission name.
int $client : Type of client. 1=back-end, 0=front-end
string $type : Type must be "group" or "user"
Get permissions from database acording to name, client and type. Returns object value.
string $name : Permission name.
int $client : Type of client. 1=back-end, 0=front-end
string $type : Type must be "group" or "user"
storePermissions ($name, $action, $client, $state, $id = null, $type = 'group')
Store permissions to AceACL database tables. Returns boolean value.
string $name : Permission name.
string $action : Action name.
int $client : Type of client. 1=back-end, 0=front-end
int $state :State must be 0=Denny, 1=Allow or -1=Inherited
int $id : Permission ID. If it is null, permission is inserted to database. If it is not null Permission is updated based on ID.
string $type : Type must be "group" or "user"
Store permissions to AceACL database tables. Returns boolean value.
string $name : Permission name.
string $action : Action name.
int $client : Type of client. 1=back-end, 0=front-end
int $state :State must be 0=Denny, 1=Allow or -1=Inherited
int $id : Permission ID. If it is null, permission is inserted to database. If it is not null Permission is updated based on ID.
string $type : Type must be "group" or "user"
getWidget ($name, $is_not_slider = false)
Display the widget in any component, Returns void value.
string $name : Name must be like "com_option.item/category.id"
boolean $is_not_slider : It determines whether the widget is shown in a slider or not
Display the widget in any component, Returns void value.
string $name : Name must be like "com_option.item/category.id"
boolean $is_not_slider : It determines whether the widget is shown in a slider or not
storeWidget ($name)
Save permissions that comes from widget to AceACL database tables. Returns void value.
string $name : Name must be like "com_option.item/category.id"
Save permissions that comes from widget to AceACL database tables. Returns void value.
string $name : Name must be like "com_option.item/category.id"
getUsersByGroup ($group_id)
Get users based on group id. Returns objectList value.
int $group_id : Group ID
Get users based on group id. Returns objectList value.
int $group_id : Group ID
getGroupsByUser ($user_id = null)
Get groups based on user id. Returns objectList value.
int $user_id : User ID. If null, the logged user's ID will be used
Get groups based on user id. Returns objectList value.
int $user_id : User ID. If null, the logged user's ID will be used
addUserToMultiGroup ($group_id, $user_id = null)
Add an user to multi group, if the user ID is null then the logged user id is used
int $group_id : Group ID
int $user_id : User ID
Add an user to multi group, if the user ID is null then the logged user id is used
int $group_id : Group ID
int $user_id : User ID
removeUserFromMultiGroup ($group_id, $user_id = null)
Remove an user from multi group, if the user ID is null then the logged user id is used
int $group_id : Group ID
int $user_id : User ID
Remove an user from multi group, if the user ID is null then the logged user id is used
int $group_id : Group ID
int $user_id : User ID
getExtension ($option)
Get the instance of the extension. Returns object value.
string $option : Component name like "com_content"
Get the instance of the extension. Returns object value.
string $option : Component name like "com_content"