Support

What we can do for you

Developers


Here you can find useful information about how to use the API class of MijoACL.


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['MijoACL']) && MijoaclApi::authorize('permissions', 'com_mijoacl')) {
    MijoaclApi::getWidget('com_kunena.category.5', true);
}

Save Permissions Widget
$defined_constants = get_defined_constants();
if (!empty($defined_constants['MijoACL']) && MijoaclApi::authorize('permissions', 'com_mijoacl')) {
    MijoaclApi::storeWidget('com_kunena.category.5', true);
}


API

MijoACL API class

Name: MijoaclApi
Type: Abstract
Since: 1.0.0
Location: administrator/components/com_mijoacl/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 getPermissionRow ([string $name = ''], [int $client = ''], [string $type = ''])
boolean setPermissions ([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])
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

getConfig ()
Get MijoACL configuration object (stdClass). Returns an MijoACL configuration object, only once created.

storeConfig ($config)
Store MijoACL 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.

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 :

loadACL ($option = false, $type = 'group')
Load the permissions from MijoACL 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"

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"

getPermissionRow ($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"

setPermissions ($name, $action, $client, $state, $id = null, $type = 'group')
Store permissions to MijoACL 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 : User/Group ID. It should not be null.
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

storeWidget ($name)
Save permissions that comes from widget to MijoACL 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

getGroupsByUser ($user_id)
Get groups based on user id. Returns objectList value.

int $user_id : User ID. If null, the logged user's ID will be used

getGroupName ($id)
Get group name based on group id. Returns sting value.

int $id : Group ID

getGroupID ($name)
Get group id based on group name. Returns int value.

string $name : Group name

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

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

getExtension ($option)
Get the instance of the extension. Returns object value.

string $option : Component name like "com_content"

Support Channels

Paid Services