本文整理汇总了PHP中ACLRole::setAction方法的典型用法代码示例。如果您正苦于以下问题:PHP ACLRole::setAction方法的具体用法?PHP ACLRole::setAction怎么用?PHP ACLRole::setAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACLRole
的用法示例。
在下文中一共展示了ACLRole::setAction方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testsetAction
public function testsetAction()
{
$aclRole = new ACLRole();
//take count of relationship initially and then after method execution and test if relationship count increases
$initial_count = count($aclRole->retrieve_relationships('acl_roles_actions', array('role_id' => '1', 'action_id' => '1', 'access_override' => '90'), 'role_id'));
$aclRole->setAction('1', '1', '90');
$final_count = count($aclRole->retrieve_relationships('acl_roles_actions', array('role_id' => '1', 'action_id' => '1', 'access_override' => '90'), 'role_id'));
$this->assertGreaterThan($initial_count, $final_count);
}
示例2: addDefaultRoles
function addDefaultRoles($defaultRoles = array())
{
global $db;
foreach ($defaultRoles as $roleName => $role) {
$ACLField = new ACLField();
$role1 = new ACLRole();
$role1->name = $roleName;
$role1->description = $roleName . " Role";
$role1_id = $role1->save();
foreach ($role as $category => $actions) {
foreach ($actions as $name => $access_override) {
if ($name == 'fields') {
foreach ($access_override as $field_id => $access) {
$ACLField->setAccessControl($category, $role1_id, $field_id, $access);
}
} else {
$queryACL = "SELECT id FROM acl_actions where category='{$category}' and name='{$name}'";
$result = $db->query($queryACL);
$actionId = $db->fetchByAssoc($result);
if (isset($actionId['id']) && !empty($actionId['id'])) {
$role1->setAction($role1_id, $actionId['id'], $access_override);
}
}
}
}
}
}
示例3: ACLRole
$role = new ACLRole();
if (isset($_REQUEST['record'])) {
$role->id = $_POST['record'];
}
if (!empty($_REQUEST['name'])) {
$role->name = $_POST['name'];
$role->description = $_POST['description'];
$role->save();
//if duplicate
if (isset($_REQUEST['isduplicate']) && !empty($_REQUEST['isduplicate'])) {
//duplicate actions
$role_actions = $role->getRoleActions($_REQUEST['isduplicate']);
foreach ($role_actions as $module) {
foreach ($module as $type) {
foreach ($type as $act) {
$role->setAction($role->id, $act['id'], $act['aclaccess']);
}
}
}
}
} else {
ob_clean();
$flc_module = 'All';
foreach ($_POST as $name => $value) {
if (substr_count($name, 'act_guid') > 0) {
$name = str_replace('act_guid', '', $name);
$role->setAction($role->id, $name, $value);
}
}
echo "result = {role_id:'{$role->id}', module:'{$flc_module}'}";
sugar_cleanup(true);
示例4: foreach
$aclrole->setAction($aclrole->id, $action_results['Contacts']['delete']['id'], ACL_ALLOW_ALL);
$action_results = ACLAction::getUserActions('will_id', true);
echo 'Actions Peon role for will<br>';
foreach ($action_results as $category_name => $category) {
foreach ($category as $action_name => $action) {
_pp($category_name . ':' . $action_name . ':' . acl_translate($action['access']));
}
}
echo 'Will is a bad peon user<br>';
echo 'Create a role for Bad Peon Users<br>';
$aclrole = new ACLRole();
$aclrole->name = 'Bad Peon User';
$aclrole->description = 'The Bad Peon Role For All Bad Peons';
$aclrole->user_id = 'will_id';
$aclrole->save();
echo 'No Bad Peon user should have access to contacts <br>';
foreach ($action_results['Contacts'] as $action) {
$aclrole->setAction($aclrole->id, $action['id'], ACL_ALLOW_NONE);
}
$action_results = ACLAction::getUserActions('will_id', true);
echo 'Actions Peon role for will<br>';
foreach ($action_results as $category_name => $category) {
foreach ($category as $action_name => $action) {
_pp($category_name . ':' . $action_name . ':' . acl_translate($action['access']));
}
}
echo 'PRINTING THE ACTIONS for a role <br>';
$role_actions = ACLRole::getRoleActions($aclrole->id);
_pp($role_actions);
echo 'PRINTING THE SESSION CACHE FOR ACL <br>';
_PP($_SESSION['ACL']);
示例5: ACLRole
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
require_once 'modules/ACL/ACLController.php';
$role = new ACLRole();
$role->name = $_POST['name'];
if (isset($_REQUEST['record'])) {
$role->id = $_POST['record'];
}
$role->description = $_POST['description'];
$role->save();
foreach ($_POST as $name => $value) {
if (substr_count($name, 'act_guid') > 0) {
$name = str_replace('act_guid', '', $name);
$role->setAction($role->id, $name, $value);
}
}
header("Location: index.php?module=ACLRoles&action=DetailView&record=" . $role->id);