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


PHP ACL类代码示例

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


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

示例1: doResetRightsOnCollection

 /**
  * Resets admin rights on a collection.
  *
  * @param \ACL        $acl
  * @param \collection $collection
  */
 private function doResetRightsOnCollection(\ACL $acl, \collection $collection)
 {
     $baseId = $collection->get_base_id();
     $acl->set_limits($baseId, false);
     $acl->remove_quotas_on_base($baseId);
     $acl->set_masks_on_base($baseId, '0', '0', '0', '0');
     $acl->update_rights_to_base($baseId, ['canputinalbum' => '1', 'candwnldhd' => '1', 'candwnldsubdef' => '1', 'nowatermark' => '1', 'candwnldpreview' => '1', 'cancmd' => '1', 'canadmin' => '1', 'canreport' => '1', 'canpush' => '1', 'creationdate' => '1', 'canaddrecord' => '1', 'canmodifrecord' => '1', 'candeleterecord' => '1', 'chgstatus' => '1', 'imgtools' => '1', 'manage' => '1', 'modify_struct' => '1', 'bas_modify_struct' => '1']);
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:14,代码来源:ACLManipulator.php

示例2: getACL

 protected function getACL()
 {
     $acl = new ACL();
     $logger = new \Monolog\Logger('ACL');
     $logger->pushHandler(new \Monolog\Handler\SyslogHandler('ACL Tests'));
     $acl->setLogger($logger);
     return $acl;
 }
开发者ID:Rudi9719,项目名称:stein-syn,代码行数:8,代码来源:SimpleTest.php

示例3: test_join_test

 function test_join_test()
 {
     ACL::add('dummy', 'blog:posts', 'add');
     $acl = new ACL();
     $this->assertTrue($acl->grant('dummy', 'blog:posts', 'add'));
     $this->assertFalse($acl->grant('dummy', 'blog:posts', 'edit'));
     ACL::remove('dummy', 'blog:posts', 'add');
     $this->assertFalse($acl->grant('dummy', 'blog:posts', 'add'));
 }
开发者ID:arunoda-susiripala,项目名称:Code51,代码行数:9,代码来源:acl_helper.php

示例4: signup_form

function signup_form($data)
{
    $user = new User();
    if ($data) {
        foreach ($data as $key => $value) {
            $field_name = ucwords(str_replace('_', ' ', $key));
            switch ($key) {
                case 'first_name':
                case 'last_name':
                case 'username':
                    if (trim($value) == '') {
                        $error[] = 'Field ' . $field_name . ' is required!';
                    }
                    break;
                case 'email':
                    if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
                        $error[] = 'Invalid format for ' . $field_name . ', please insert a valid email!';
                    }
                    break;
            }
        }
        // Verify Username
        $user->byUsername($data['username']);
        if ($data['username'] = $user->username) {
            $error[] = 'Username already taken. Please select another one.';
        }
        if ($data['password'] != $data['password2']) {
            $error[] = 'Password does not match.';
        }
        // Adding values
        if ($data['password']) {
            $user->password = $data['password'];
            $gen_pass = false;
        } else {
            $gen_pass = true;
        }
        if (!$error) {
            $res = $user->create(false, $gen_pass, $data);
            if ($res) {
                session_start();
                $ACL = new ACL();
                $ACL->username = $res->username;
                $ACL->password = $res->temp_password;
                $ACL->login();
                header("Location: /dashboard.php");
            } else {
                $error[] = 'Ops, We could not create the user at this time. Try again later.';
            }
        }
    }
    global $twig;
    // Twig Base
    $template = $twig->loadTemplate('signup-content.html');
    $template->display(array('project_title' => TITLE, 'path_to_theme' => '../../' . THEME_PATH, 'company' => NATURAL_COMPANY, 'page' => 'signup', 'data' => $data, 'errors' => $error));
}
开发者ID:enettolima,项目名称:mvno-platform,代码行数:55,代码来源:signup.controller.php

示例5: processAclRequest

 private function processAclRequest()
 {
     $dom = $this->xmlDom;
     $headerNode = $dom->getElementsByTagName('SIF_Header')->item(0);
     $originalMsgId = $headerNode->getElementsByTagName('SIF_MsgId')->item(0)->nodeValue;
     $originalSourceId = $headerNode->getElementsByTagName('SIF_SourceId')->item(0)->nodeValue;
     $acl = new ACL($dom);
     $timestamp = Utility::createTimestamp();
     $msgId = Utility::createMessageId();
     XmlHelper::buildSuccessMessage($msgId, $timestamp, $originalSourceId, $originalMsgId, 0, $originalMsg = $acl->BuildACL(), $desc = null);
 }
开发者ID:Koulio,项目名称:OpenZIS,代码行数:11,代码来源:SystemControl.php

示例6: getAllForUser

 /**
  * Returns all the feeds a user can access.
  *
  * @return \Doctrine\Common\Collections\Collection
  */
 public function getAllForUser(\ACL $userACL)
 {
     $base_ids = array_keys($userACL->get_granted_base());
     $qb = $this->createQueryBuilder('f');
     $qb->where($qb->expr()->isNull('f.baseId'))->orWhere('f.public = true');
     if (count($base_ids) > 0) {
         $qb->orWhere($qb->expr()->in('f.baseId', $base_ids));
     }
     $qb->orderBy('f.updatedOn', 'DESC');
     return $qb->getQuery()->getResult();
 }
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:16,代码来源:FeedRepository.php

示例7: permissions

 public function permissions()
 {
     $this->form_validation->set_rules('resource', 'resource', 'required');
     return Validation::validate($this, 'user', 'read', function ($token, $output) {
         $resource = $this->input->post('resource');
         $acl = new ACL();
         $permissions = $acl->userPermissions($token->id, $resource);
         $output['status'] = true;
         $output['resource'] = $resource;
         $output['permissions'] = $permissions;
         return $output;
     });
 }
开发者ID:ferycode,项目名称:angularjs-ci3,代码行数:13,代码来源:User.php

示例8: action_plugin_deactivation

 public function action_plugin_deactivation($file)
 {
     if ($file == str_replace('\\', '/', $this->get_file())) {
         # delete default access token
         ACL::destroy_token('manage_cronjobs');
     }
 }
开发者ID:habari-extras,项目名称:crontabmanager,代码行数:7,代码来源:crontabmanager.plugin.php

示例9: render_item

 protected function render_item(&$next_id, $name, $cfg, $parent)
 {
     $menu = '';
     if ($parent == -1) {
         $menu .= Ext::menu_begin($name);
     }
     if (is_array($cfg)) {
         $cur_id = $next_id;
         $cur_menu = '';
         if ($parent != -1) {
             $cur_menu .= Ext::menu_row($next_id, $name, NULL, $parent);
         }
         $next_id++;
         $cur_menu_subitems = '';
         foreach ($cfg as $subname => $subcfg) {
             $cur_menu_subitems .= $this->render_item($next_id, $subname, $subcfg, $cur_id);
         }
         if (!empty($cur_menu_subitems)) {
             $menu .= $cur_menu . $cur_menu_subitems;
         }
     } else {
         if (ACL::is_route_allowed($cfg)) {
             $menu .= Ext::menu_row($next_id, $name, $cfg, $parent);
             if ($this->is_route_active($cfg)) {
                 $this->_active_id = $next_id;
             }
         }
         $next_id++;
     }
     if ($parent == -1) {
         $menu .= Ext::menu_end($this->_active_id);
     }
     return $menu;
 }
开发者ID:ariol,项目名称:adminshop,代码行数:34,代码来源:Menu.php

示例10: action_user

 public function action_user()
 {
     $id = (int) $this->request->param('id', 0);
     $post = ORM::factory('user', $id);
     if (!$post->loaded() or $id === 1) {
         Message::error(__("User doesn't exists!"));
         Log::error('Attempt to access non-existent user.');
         $this->request->redirect(Route::get('admin/user')->uri(array('action' => 'list')), 404);
     }
     $this->title = __(':user Permissions', array(":user" => $post->name));
     $action = Route::get('admin/permission')->uri(array('action' => 'user', 'id' => isset($post->id) ? $post->id : 0));
     $view = View::factory('admin/permission/user')->set('post', $post)->set('oldperms', $post->perms())->set('permissions', ACL::all())->set('action', $action)->bind('errors', $this->_errors);
     if ($this->valid_post('permissions')) {
         $perms = array_filter($_POST['perms']);
         $post->data = array('permissions' => $perms);
         try {
             $post->save();
             Message::success(__('Permissions: saved successful!'));
             $this->request->redirect(Route::get('admin/permission')->uri(array('action' => 'user', 'id' => $post->id)));
         } catch (ORM_Validation_Exception $e) {
             Message::error(__('Permissions save failed!'));
             $this->_errors = $e->errors('models', TRUE);
         } catch (Exception $e) {
             Message::error(__('Permissions save failed!'));
             $this->_errors = array($e->getMessage());
         }
     }
     $this->response->body($view);
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:29,代码来源:permission.php

示例11: before

 /**
  * The before() method is called before controller action
  *
  * @uses  ACL::required
  */
 public function before()
 {
     ACL::required('access comment');
     // Disable sidebars on comments page
     $this->_sidebars = FALSE;
     parent::before();
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:12,代码来源:comment.php

示例12: action_plugin_deactivation

 public function action_plugin_deactivation($file)
 {
     if (realpath($file) == __FILE__) {
         CronTab::delete_cronjob('pbem_check_accounts');
         ACL::destroy_token('PBEM');
     }
 }
开发者ID:habari-extras,项目名称:pbem,代码行数:7,代码来源:pbem.plugin.php

示例13: setUp

 public function setUp()
 {
     parent::setUp();
     $model = new TestDocument();
     $model->createDatabaseTable(true);
     Helper::dbFixture(SITEMAP_TABLE, []);
     \ACL::create(SitemapModel::PermissionName);
     Configure::write('Sitemap', ['Menu' => ['title' => self::Title, 'depth' => 3]]);
     Helper::setupUsers([['login' => self::AdminUser, 'rights' => [SitemapModel::PermissionName => true]], ['login' => self::GuestUser]]);
     $documents = [['name' => 'first', 'sitemap' => ['count' => 1]], ['name' => 'second'], ['name' => 'third', 'sitemap' => ['parent' => 1]]];
     foreach ($documents as $key => $row) {
         $documents[$key] = new TestDocument($row);
         $documents[$key]->insert();
         $sitemapModel = new SitemapModel();
         $sitemapModel->name = $row['name'];
         $sitemapModel->full_url = $row['name'];
         $sitemapModel->linkToModel($documents[$key]);
         if (isset($row['sitemap'])) {
             foreach ($row['sitemap'] as $key => $value) {
                 $sitemapModel->{$key} = $value;
             }
         }
         $sitemapModel->insert();
     }
 }
开发者ID:gudwin,项目名称:extasy,代码行数:25,代码来源:SitemapMenuItemTest.php

示例14: instance

 /**
  * @return ACL
  */
 public static function instance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
开发者ID:ariol,项目名称:adminshop,代码行数:10,代码来源:ACL.php

示例15: loadAccess

 /**
  * Загрузка информации о правах пользователя.
  */
 private function loadAccess()
 {
     if (null === $this->access) {
         $this->access = ACL::getTypeAccess($this->getGroups());
     }
     return $this->access;
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:10,代码来源:class.user.php


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