How do I create new actions or new set of actions for permissions?
Dear developers,
May I know where would I be able to add new actions for the permissions module via the UNA studio as I do not see any option or buttons to add new actions for permissions. In addition, if this is only achievable via the changing of codes, may I know where are the related files pertaining to this located in the project so that I would be able to make amendments to it.
-
-
·
LeonidS
- ·
Hello zhalkiar !
If you need to create a new action which is missing in the ready UNA 's code you need to perform the following actions:
1) add in your code the calling of the function checkActionModule from the inc/classes/BxDolAcl.php file where need to pass item id (profile or entry), name of the action (like 'view entry') and name of the module (use the $this->getName() method calling) it will look like:
$aCheck = checkActionModule($this->_iProfileId, 'allow view', $this->getName(), $isPerformAction);
if ($aCheck[CHECK_ACTION_RESULT] === CHECK_ACTION_RESULT_ALLOWED) {
// code of allowed action
}
2) add the record about this action to the sys_acl_actions table, for the given example it will look like:
INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
('{module name}', '{action name [this name will be added to the allow prefix ] }', NULL, '{the language key of the title}', '', 1, 0);
SET @iIdActionProfileView = LAST_INSERT_ID();
-
·
LeonidS
-