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


PHP SecurityUtil::accesslevelnames方法代码示例

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


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

示例1: listedit

    /**
     * Edit / Create permissions in the mainview.
     *
     * @return boolean
     */
    public function listedit()
    {
        // Security check
        if (!SecurityUtil::checkPermission('Permissions::', '::', ACCESS_ADMIN)) {
            return LogUtil::registerPermissionError();
        }

        // Get parameters from whatever input we need.
        $chgpid = FormUtil::getPassedValue('chgpid', null, 'GET');
        $action = FormUtil::getPassedValue('action', null, 'GET');
        $insseq = FormUtil::getPassedValue('insseq', null, 'GET');
        $permgrp = FormUtil::getPassedValue('permgrp', null, 'REQUEST');

        // decide default view
        $rowview = is_null($this->getVar('rowview')) ? '25' : $this->getVar('rowview');

        // Assign the permission levels
        $this->view->assign('permissionlevels', SecurityUtil::accesslevelnames());

        // Work out which tables to operate against, and
        // various other bits and pieces
        $dbtable = DBUtil::getTables();
        $permcolumn = $dbtable['group_perms_column'];
        $mlpermtype = $this->__('Group');
        $viewperms = ($action == 'modify') ? $this->__('Modify permission rule') : $this->__('Create new permission rule');
        $ids = $this->getGroupsInfo();

        $orderBy = "ORDER BY $permcolumn[sequence]";
        $objArray = DBUtil::selectObjectArray('group_perms', '', $orderBy);
        if (!$objArray && $action != 'add') {
            LogUtil::registerError($this->__('Error! No permission rules of this kind were found. Please add some first.'));
            $this->redirect(ModUtil::url('modules', 'admin', 'view'));
        }

        $this->view->assign('title', $viewperms)
                ->assign('mlpermtype', $mlpermtype);

        $accesslevels = SecurityUtil::accesslevelnames();
        $numrows = count($objArray);

        $this->view->assign('idvalues', $ids);

        if ($action == 'modify') {
            // Form-start
            $this->view->assign('formurl', ModUtil::url('Permissions', 'admin', 'update'))
                    ->assign('permgrp', $permgrp)
                    ->assign('chgpid', $chgpid);

            // Realms hard-code4d - jgm
            $this->view->assign('realm', 0)
                    ->assign('insseq', $chgpid)
                    ->assign('submit', $this->__('Edit permission rule'));
        } elseif ($action == 'insert') {
            $this->view->assign('formurl', ModUtil::url('Permissions', 'admin', 'create'))
                    ->assign('permgrp', $permgrp)
                    ->assign('insseq', $insseq);

            // Realms hard-coded - jgm
            $this->view->assign('realm', 0)
                    ->assign('submit', $this->__('Create new permission rule'));
        } elseif ($action == 'add') {
            // Form-start
            $this->view->assign('formurl', ModUtil::url('Permissions', 'admin', 'create'))
                    ->assign('permgrp', $permgrp)
                    ->assign('insseq', -1);

            // Realms hard-coded - jgm
            $this->view->assign('realm', 0)
                    ->assign('submit', $this->__('Create new permission rule'));
        }

        $this->view->assign('action', $action);

        $permissions = array();
        $ak = array_keys($objArray);
        foreach ($ak as $v) {
            $obj = & $objArray[$v];
            $id = $obj['gid']; //get's uid or gid accordingly
            $permissions[] = array(// Realms not currently functional so hide the output - jgm
                    //'realms' => $realms[$realm],
                    'pid' => $obj['pid'],
                    'group' => $ids[$id],
                    'component' => $obj['component'],
                    'instance' => $obj['instance'],
                    'accesslevel' => $accesslevels[$obj['level']],
                    'level' => $obj['level'],
                    'sequence' => $obj['sequence']);
            if ($action == 'modify' && $obj['pid'] == $chgpid) {
                $this->view->assign('selectedid', $id);
            }
        }
        $this->view->assign('permissions', $permissions);

        return $this->view->fetch('permissions_admin_listedit.tpl');
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:100,代码来源:Admin.php

示例2: createpermission

 /**
  * Create a blank permission and return it
  *
  * @return mixed array with new permission or Ajax error
  */
 public function createpermission()
 {
     $this->checkAjaxToken();
     $this->throwForbiddenUnless(SecurityUtil::checkPermission('Permissions::', '::', ACCESS_ADMIN));
     // add a blank permission
     $dummyperm = array('realm' => 0, 'id' => 0, 'component' => '.*', 'instance' => '.*', 'level' => ACCESS_NONE, 'insseq' => -1);
     $newperm = ModUtil::apiFunc('Permissions', 'admin', 'create', $dummyperm);
     if ($newperm == false) {
         AjaxUtil::error($this->__('Error! Could not create new permission rule.'));
     }
     $accesslevels = SecurityUtil::accesslevelnames();
     $newperm['instance'] = DataUtil::formatForDisplay($newperm['instance']);
     $newperm['component'] = DataUtil::formatForDisplay($newperm['component']);
     $newperm['levelname'] = $accesslevels[$newperm['level']];
     $newperm['groupname'] = $this->__('Unregistered');
     return new Zikula_Response_Ajax($newperm);
 }
开发者ID:,项目名称:,代码行数:22,代码来源:

示例3: accesslevelnames

/**
 * get access level names
 *
 * @deprecated
 * @see SecurityUtil::accesslevelnames()
 * @return array of access names
 */
function accesslevelnames()
{
    LogUtil::log(__f('Warning! Function %1$s is deprecated. Please use %2$s instead.', array(
        'accesslevelnames()',
        'SecurityUtil::accesslevelnames()')), E_USER_DEPRECATED);
    return SecurityUtil::accesslevelnames();
}
开发者ID:,项目名称:,代码行数:14,代码来源:


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