当前位置: 首页>>代码示例>>PHP>>正文


PHP ACLAction::save方法代码示例

本文整理汇总了PHP中ACLAction::save方法的典型用法代码示例。如果您正苦于以下问题:PHP ACLAction::save方法的具体用法?PHP ACLAction::save怎么用?PHP ACLAction::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ACLAction的用法示例。


在下文中一共展示了ACLAction::save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addActions

 /**
  * static addActions($category, $type='module')
  * Adds all default actions for a category/type
  *
  * @param STRING $category - the category (e.g module name - Accounts, Contacts)
  * @param STRING $type - the type (e.g. 'module', 'field')
  */
 function addActions($category, $type = 'module')
 {
     global $ACLActions;
     $db = DBManagerFactory::getInstance();
     if (isset($ACLActions[$type])) {
         foreach ($ACLActions[$type]['actions'] as $action_name => $action_def) {
             $action = new ACLAction();
             $query = "SELECT * FROM " . $action->table_name . " WHERE name='{$action_name}' AND category = '{$category}' AND acltype='{$type}' AND deleted=0 ";
             $result = $db->query($query);
             //only add if an action with that name and category don't exist
             $row = $db->fetchByAssoc($result);
             if ($row == null) {
                 $action->name = $action_name;
                 $action->category = $category;
                 $action->aclaccess = $action_def['default'];
                 $action->acltype = $type;
                 $action->modified_user_id = 1;
                 $action->created_by = 1;
                 $action->save();
             }
         }
     } else {
         sugar_die("FAILED TO ADD: {$category} : {$name} - TYPE {$type} NOT DEFINED IN modules/ACLActions/actiondefs.php");
     }
 }
开发者ID:klr2003,项目名称:sourceread,代码行数:32,代码来源:ACLAction.php

示例2: array

$testmodules = array('Accounts', 'Contacts', 'Users');
foreach ($testmodules as $module) {
    foreach ($actions as $cur_action) {
        $action = new ACLAction();
        $action->name = $cur_action;
        $action->category = $module;
        if (isset($default_owner[$cur_action])) {
            $action->access = ACL_ALLOW_OWNER;
        } else {
            if (isset($default_deny[$cur_action])) {
                $action->access = ACL_ALLOW_NONE;
            } else {
                $action->access = ACL_ALLOW_ALL;
            }
        }
        $action->save();
    }
}
$action_results = ACLAction::getUserActions('will_id', true);
echo 'Actions Test no roles for will -access to all modules -owner delete and no import or export<br>';
foreach ($action_results as $category_name => $category) {
    foreach ($category as $action_name => $action) {
        _pp($category_name . ':' . $action_name . ':' . acl_translate($action['access']));
    }
}
echo 'Create a role for Peon Users<br>';
$aclrole = new ACLRole();
$aclrole->name = 'Peon User';
$aclrole->description = 'The Peon Role For All Peons';
$aclrole->user_id = 'will_id';
$aclrole->save();
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:31,代码来源:test_actions.php


注:本文中的ACLAction::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。