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


PHP Role::getName方法代码示例

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


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

示例1: setParent

 /**
  * Set the parent role
  *
  * @param  Role $parent
  * @return Role
  */
 public function setParent(Role $parent)
 {
     if ($parent->getName() !== $this->getName()) {
         $this->parent = $parent;
         $this->parent->addChild($this);
     }
     return $this;
 }
开发者ID:hasanlock,项目名称:pop-acl,代码行数:14,代码来源:Role.php

示例2: fill

 /**
  * {@inheritdoc}
  * @param \Role $role
  */
 public function fill($form, $role)
 {
     $form->get('name')->setData($role->getName());
     $form->get('display_as_leader')->setData($role->displayAsLeader());
     $form->get('display_icon')->setData($role->getDisplayIcon());
     $form->get('display_color')->setData($role->getDisplayColor());
     $form->get('display_name')->setData($role->getDisplayName());
     $form->get('display_order')->setData($role->getDisplayOrder());
     $form->get('permissions')->setData($role->getPermObjects());
 }
开发者ID:allejo,项目名称:bzion,代码行数:14,代码来源:RoleFormCreator.php

示例3: isAllowed

 /**
  * Check owing Role & Resource and match its with $roleName & $resourceName;
  * if match was found depending on action allow or deny access to $resourceName for $roleName.
  *
  * @param string $needRuleName
  * @param string $needRoleName
  * @param string $needResourceName
  *
  * @return RuleResult|null null is returned if there is no matched Role & Resource in this rule.
  *                         RuleResult otherwise.
  */
 public function isAllowed($needRuleName, $needRoleName, $needResourceName)
 {
     static $roleCache = array();
     static $resourceCache = array();
     if ($needRuleName != 'RuleWide' && $this->name === $needRuleName || $this->isRuleMatched($needRuleName)) {
         if (null !== $this->role) {
             $roleNameTmp = $this->role->getName();
             if (!isset($roleCache[$roleNameTmp])) {
                 $roles = iterator_to_array($this->role);
                 $roleCache[$roleNameTmp] = $roles;
             } else {
                 $roles = $roleCache[$roleNameTmp];
             }
         } else {
             $roles = array(null);
         }
         if (null !== $this->resource) {
             $resourceNameTmp = $this->resource->getName();
             if (!isset($resourceCache[$resourceNameTmp])) {
                 $resources = iterator_to_array($this->resource);
                 $resourceCache[$resourceNameTmp] = $resources;
             } else {
                 $resources = $resourceCache[$resourceNameTmp];
             }
         } else {
             $resources = array(null);
         }
         foreach ($roles as $role) {
             if (null === $role || $role && $role->name === $needRoleName) {
                 $roleNameMatched = true;
             } else {
                 $roleNameMatched = false;
             }
             foreach ($resources as $resource) {
                 if (null === $resource || $resource && $resource->name === $needResourceName) {
                     $resourceNameMatched = true;
                 } else {
                     $resourceNameMatched = false;
                 }
                 // Check if $role and $resource match to need role and resource.
                 $ruleResult = null;
                 if ($roleNameMatched === true && $resourceNameMatched === true) {
                     $ruleResult = new RuleResult($this, $needRoleName, $needResourceName);
                 }
                 if ($ruleResult) {
                     return $ruleResult;
                 }
             }
         }
     }
     return null;
 }
开发者ID:voku,项目名称:simpleacl,代码行数:63,代码来源:Rule.php

示例4: testCreateRoleWithProjectReference

 public function testCreateRoleWithProjectReference()
 {
     $xml = simplexml_load_file($this->roleProjectFile);
     $expectedId = 'RELATED_PROJECT';
     $expectedUrl = 'http://example.com/youtrack/rest/admin/project/' . $expectedId;
     $role = new Role($xml);
     $this->assertEquals('Developer', $role->getName());
     $this->assertNotEmpty($role->getProjectRefs());
     $this->assertCount(1, $role->getProjectRefs());
     $refs = $role->getProjectRefs();
     $ref0 = $refs[0];
     $this->assertEquals($expectedId, $ref0->getId());
     $this->assertEquals($expectedUrl, $ref0->getUrl());
 }
开发者ID:Angerslave,项目名称:youtrack,代码行数:14,代码来源:RoleTest.php

示例5: testNormalRole

 public function testNormalRole()
 {
     $role = new Role($this->normalRole->getId());
     $this->player_b->addRole($role->getId());
     $this->assertFalse($role->displayAsLeader());
     $this->assertFalse($role->isProtected());
     $this->assertEquals("Sample Normal Role", $role->getName());
     $this->assertNull($role->getDisplayIcon());
     $this->assertNull($role->getDisplayColor());
     $this->assertEquals("Sample Normal Role", $role->getDisplayName());
     $this->assertEquals(-1, $role->getDisplayOrder());
     $this->assertArrayContainsModel($role, Role::getRoles($this->player_b->getId()));
     $this->wipe($role);
 }
开发者ID:kleitz,项目名称:bzion,代码行数:14,代码来源:RoleTest.php

示例6: array

 /**
  * Set specific role as default role
  *
  * @param void
  * @return null
  */
 function set_as_default()
 {
     if ($this->request->isSubmitted()) {
         if ($this->active_role->isNew()) {
             $this->httpError(HTTP_ERR_NOT_FOUND);
         }
         // if
         if ($this->active_role->getType() == ROLE_TYPE_PROJECT) {
             $this->httpError(HTTP_ERR_INVALID_PROPERTIES);
         }
         // if
         ConfigOptions::setValue('default_role', $this->active_role->getId());
         flash_success(':name role has been set as default', array('name' => $this->active_role->getName()));
         $this->redirectTo('admin_roles');
     } else {
         $this->httpError(HTTP_ERR_BAD_REQUEST);
     }
     // if
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:25,代码来源:RolesAdminController.class.php

示例7: getName

 public function getName()
 {
     $this->_load();
     return parent::getName();
 }
开发者ID:himel31,项目名称:doctrine2yml-zfmodules,代码行数:5,代码来源:RoleProxy.php

示例8: getName

 /**
  * Return display name property. (readonly)
  *
  * @author KnowledgeTree Team
  * @access public
  * @return string
  */
 public function getName()
 {
     return $this->role->getName();
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:11,代码来源:KTAPIAcl.inc.php

示例9: deleteRole

 public function deleteRole(Role $roleToDelete)
 {
     // check permissions
     if (!PermissionEngine::getInstance()->currentUserCanDo('userCanDeleteRoles')) {
         return false;
     }
     $db = Database::getInstance();
     if (!$db->isConnected()) {
         return false;
     }
     $roleID = $db->escapeString($roleToDelete->getID());
     $roleName = $db->escapeString($roleToDelete->getName());
     $results = $db->removeData('role', 'roleID = ' . $roleID . ' AND roleName = \'' . $roleName . '\'');
     if (!$results) {
         return false;
     }
     return true;
 }
开发者ID:educask,项目名称:EducaskCore,代码行数:18,代码来源:RoleEngine.php

示例10: has

 /**
  * @param Role|string $role
  *
  * @throws \InvalidArgumentException
  *
  * @return bool
  */
 public function has($role)
 {
     if (is_scalar($role)) {
         $role = new Role($role);
     } elseif (!$role instanceof Role) {
         throw new \InvalidArgumentException('$role is expected to be of type string or Gobline\\Acl\\Role');
     }
     $roleName = $role->getName();
     return isset($this->roles[$roleName]);
 }
开发者ID:gobline,项目名称:acl,代码行数:17,代码来源:RoleCollection.php

示例11: CompareNoRef

 /**
  * TODO: Enter description here ...
  * @param Role $a
  * @param Role $b
  * @return number
  */
 function CompareNoRef($a, $b)
 {
     $ap = $a->getHomeProject();
     $bp = $b->getHomeProject();
     if ($ap == NULL && $bp != NULL) {
         return 1;
     } elseif ($ap != NULL && $bp == NULL) {
         return -1;
     } elseif ($ap == NULL && $bp == NULL) {
         $tmp = strcoll($a->getName(), $b->getName());
         return $tmp;
     } else {
         $projcmp = new ProjectComparator();
         $projcmp->criterion = 'name';
         $tmp = $projcmp->Compare($ap, $bp);
         if ($tmp) {
             /* Different projects, sort accordingly */
             return $tmp;
         }
         return strcoll($a->getName(), $b->getName());
     }
 }
开发者ID:nterray,项目名称:tuleap,代码行数:28,代码来源:RBAC.php

示例12: addRole

 /**
  * 添加一个角色,如果角色名已经存在,则替换老值
  * @param Role $role
  * @return \tfc\auth\Authoriz
  */
 public function addRole(Role $role)
 {
     $name = $role->getName();
     $this->_roles[$name] = $role;
     return $this;
 }
开发者ID:suyuanen,项目名称:trotri,代码行数:11,代码来源:Authoriz.php

示例13: testGetName

 public function testGetName()
 {
     $role = new Role('admin');
     $this->assertEquals('admin', $role->getName());
 }
开发者ID:hbarcelos,项目名称:spice-acl,代码行数:5,代码来源:RoleTest.php


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