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


PHP UserRole::setName方法代码示例

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


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

示例1: createUserRole

 /**
  * @param int $id
  * @param string $roleName
  * @return UserRole
  */
 public static function createUserRole($id, $roleName)
 {
     $useRole = new UserRole();
     $useRole->setId($id);
     $useRole->setName($roleName);
     return $useRole;
 }
开发者ID:euBatham,项目名称:javacature,代码行数:12,代码来源:UserRoleFactory.class.php

示例2: mapDtoToUserRole

 public function mapDtoToUserRole(RoleDto $roleDto)
 {
     $userRole = new UserRole();
     $userRole->setId($roleDto->getId());
     $userRole->setName($roleDto->getName());
     return $userRole;
 }
开发者ID:euBatham,项目名称:javacature,代码行数:7,代码来源:UserRoleMapper.class.php

示例3: testCreate

 public function testCreate()
 {
     $userRole = new UserRole();
     $userRole->setName('Administrator');
     $userRole->setDescription('Admin account with access to everything.');
     $this->assertSame('Administrator', $userRole->getName());
     $this->assertSame('Admin account with access to everything.', $userRole->getDescription());
 }
开发者ID:pdt256,项目名称:truecar,代码行数:8,代码来源:UserRoleTest.php

示例4: testHasRoles

 public function testHasRoles()
 {
     $adminRole = new UserRole();
     $adminRole->setName('admin');
     $user = new User();
     $user->addRole($adminRole);
     $this->assertTrue($user->hasRoles(['admin']));
     $this->assertFalse($user->hasRoles(['developer']));
 }
开发者ID:pdt256,项目名称:truecar,代码行数:9,代码来源:UserTest.php

示例5: copyToPartner

 /**
  * Copy current role to the given partner.
  * @param int $partnerId
  */
 public function copyToPartner($partnerId)
 {
     $newRole = new UserRole();
     $newRole->setName($this->getName());
     $newRole->setDescription($this->getDescription());
     $newRole->setStatus($this->getStatus());
     $newRole->setPermissionNames(parent::getPermissionNames());
     $newRole->setCustomData($this->getCustomData());
     $newRole->setPartnerId($partnerId);
     // set new partner id
     $newRole->setTags($this->getTags());
     return $newRole;
 }
开发者ID:AdiTal,项目名称:server,代码行数:17,代码来源:UserRole.php

示例6: testGetNonPredefinedUserRoles

 /**
  * @covers SystemUserService::getNonPredefinedUserRoles
  */
 public function testGetNonPredefinedUserRoles()
 {
     $userRoles = new Doctrine_Collection('UserRole');
     for ($i = 0; $i < 2; $i++) {
         $userRole = new UserRole();
         $userRole->setId($i + 1);
         $userRole->setName("test name" . $i + 1);
         $userRole->setIsAssignable(1);
         $userRole->setIsPredefined(0);
         $userRoles->add($userRole);
     }
     $dao = $this->getMock('SystemUserDao');
     $dao->expects($this->once())->method('getNonPredefinedUserRoles')->will($this->returnValue($userRoles));
     $this->systemUserService->setSystemUserDao($dao);
     $result = $this->systemUserService->getNonPredefinedUserRoles();
     $this->assertEquals($userRoles, $result);
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:20,代码来源:SystemUserServiceTest.php

示例7: UserRole

$role->setPermissionNames($uploaderPermissions);
$role->setStatus(UserRoleStatus::ACTIVE);
$role->setTags('kmc');
$role->setPartnerId(99);
$userRoles[] = $role;
$role = new UserRole();
$role->setName('Content Moderator');
$role->setDescription('Access to publisher content moderation panel');
$moderatorPermissions = 'KMC_ACCESS,KMC_READ_ONLY,CONTENT_MODERATE_APPROVE_REJECT,CONTENT_MODERATE_BASE,CONTENT_MODERATE_METADATA,CONTENT_MODERATE_CUSTOM_DATA';
$role->setPermissionNames($moderatorPermissions);
$role->setStatus(UserRoleStatus::ACTIVE);
$role->setTags('kmc');
$role->setPartnerId(99);
$userRoles[] = $role;
$role = new UserRole();
$role->setName('Player Designer');
$role->setDescription('Access to publisher studio');
$designerPermissions = 'KMC_ACCESS,KMC_READ_ONLY,STUDIO_BASE,STUDIO_ADD_UICONF,STUDIO_UPDATE_UICONF,STUDIO_DELETE_UICONF,STUDIO_BRAND_UICONF';
$role->setPermissionNames($designerPermissions);
$role->setStatus(UserRoleStatus::ACTIVE);
$role->setTags('kmc');
$role->setPartnerId(99);
$userRoles[] = $role;
//------------------------------------------------------
foreach ($userRoles as $newRole) {
    if ($dryRun) {
        KalturaLog::log('DRY RUN - Adding new role - ' . print_r($newRole, true));
    } else {
        KalturaLog::log('Adding new role - ' . print_r($newRole, true));
        $newRole->save();
    }
开发者ID:richhl,项目名称:kalturaCE,代码行数:31,代码来源:03_create_base_user_roles.php

示例8: __convertRoleNamesToObjects

 private function __convertRoleNamesToObjects(array $roleNames)
 {
     $roles = array();
     foreach ($roleNames as $name) {
         $userRole = new UserRole();
         $userRole->setName($name);
         $roles[] = $userRole;
     }
     return $roles;
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:10,代码来源:BasicUserRoleManagerTest.php

示例9: UserRole

$role->setDescription('Support manager');
$permissions = 'SYSTEM_ADMIN_BASE,SYSTEM_ADMIN_PUBLISHER_BASE,SYSTEM_ADMIN_PUBLISHER_KMC_ACCESS,SYSTEM_ADMIN_PUBLISHER_CONFIG,SYSTEM_ADMIN_PUBLISHER_BLOCK,SYSTEM_ADMIN_PUBLISHER_ADD,SYSTEM_ADMIN_PUBLISHER_USAGE,SYSTEM_ADMIN_DEVELOPERS_TAB,SYSTEM_ADMIN_BATCH_CONTROL,SYSTEM_ADMIN_CONTENT_DISTRIBUTION_BASE,SYSTEM_ADMIN_CONTENT_DISTRIBUTION_MODIFY';
$role->setPermissionNames($permissions);
$role->setStatus(UserRoleStatus::ACTIVE);
$role->setTags('admin_console');
$userRoles['ps'] = $role;
$role = new UserRole();
$role->setName('Publishers Administrator');
$role->setDescription('Publishers Administrator');
$permissions = 'SYSTEM_ADMIN_BASE,SYSTEM_ADMIN_PUBLISHER_BASE,SYSTEM_ADMIN_PUBLISHER_KMC_ACCESS,SYSTEM_ADMIN_PUBLISHER_CONFIG,SYSTEM_ADMIN_PUBLISHER_BLOCK,SYSTEM_ADMIN_PUBLISHER_ADD,SYSTEM_ADMIN_PUBLISHER_USAGE,SYSTEM_ADMIN_DEVELOPERS_TAB';
$role->setPermissionNames($permissions);
$role->setStatus(UserRoleStatus::ACTIVE);
$role->setTags('admin_console');
$userRoles[] = $role;
$role = new UserRole();
$role->setName('Guest');
$role->setDescription('Guest');
$permissions = 'SYSTEM_ADMIN_BASE';
$role->setPermissionNames($permissions);
$role->setStatus(UserRoleStatus::ACTIVE);
$role->setTags('admin_console');
$userRoles['guest'] = $role;
//------------------------------------------------------
foreach ($userRoles as $key => $newRole) {
    $newRole->setPartnerId(-2);
    // set admin console partner id (-2)
    if ($dryRun) {
        KalturaLog::log('DRY RUN - Adding new role - ' . print_r($newRole, true));
    } else {
        KalturaLog::log('Adding new role - ' . print_r($newRole, true));
        $newRole->save();
开发者ID:richhl,项目名称:kalturaCE,代码行数:31,代码来源:01_create_base_admin_console_roles_and_migrate_users.php

示例10: isset

<?php

/**
 * @package deployment
 *
 * Create playback-only user role
 *
 * No need to re-run after server code deploy
 */
chdir(__DIR__);
require_once __DIR__ . '/../../bootstrap.php';
$realRun = isset($argv[1]) && $argv[1] == 'realrun';
KalturaStatement::setDryRun(!$realRun);
$userRole = new UserRole();
$userRole->setStrId('PLAYBACK_BASE_ROLE');
$userRole->setName('PLAYBACK BASE ROLE');
$userRole->setSystemName('PLAYBACK_BASE_ROLE');
$userRole->setDescription('Only playback');
$userRole->setPartnerId(0);
$userRole->setStatus(UserRoleStatus::ACTIVE);
$userRole->setPermissionNames('PLAYBACK_BASE_PERMISSION');
$userRole->save();
开发者ID:DBezemer,项目名称:server,代码行数:22,代码来源:2014_08_03_create_base_playback_role.php

示例11: testGetAccessibleUserRoleIds

 public function testGetAccessibleUserRoleIds()
 {
     $mockService = $this->getMock('SystemUserService');
     $roleList = new Doctrine_Collection('SystemUser');
     for ($i = 0; $i < 3; $i++) {
         $userRole = new UserRole();
         $userRole->setId($i + 1);
         $userRole->setName('test' . $i + 1);
         $roleList->add($userRole);
     }
     $mockService->expects($this->once())->method('getAssignableUserRoles')->will($this->returnValue($roleList));
     $this->adminUserRole->setSystemUserService($mockService);
     $roleIds = $this->adminUserRole->getAccessibleUserRoleIds(null, null);
     $this->assertEquals($roleIds, array(1, 2, 3));
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:15,代码来源:AdminUserRoleTest.php

示例12: getOrCreateUserSessionRole

function getOrCreateUserSessionRole($partnerId)
{
    PartnerPeer::clearInstancePool();
    $partner = PartnerPeer::retrieveByPK($partnerId);
    $role = null;
    $id = $partner->getUserSessionRoleId();
    if ($id) {
        $role = UserRolePeer::retrieveByPK($id);
    }
    if (!$role) {
        $role = new UserRole();
        $role->setPartnerId($partnerId);
        $role->setStatus(UserRoleStatus::ACTIVE);
        $role->setName('Partner ' . $partnerId . ' user session permission');
        $role->setDescription('Partner ' . $partnerId . ' user session permission');
        $role->setPermissionNames(PermissionName::USER_SESSION_PERMISSION);
        $role->save();
    }
    return $role;
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:20,代码来源:02_add_special_partner_permissions.php

示例13: testGetScreenPermissions

 public function testGetScreenPermissions()
 {
     $userRole = new UserRole();
     $userRole->setId(1);
     $userRole->setName('Admin');
     $user = new SystemUser();
     $user->setId(1);
     $user->setEmpNumber(NULL);
     $user->setUserRole($userRole);
     $systemUserService = $this->getMock('SystemUserService', array('getSystemUser'));
     $systemUserService->expects($this->once())->method('getSystemUser')->with($user->getId())->will($this->returnValue($user));
     $this->manager->setSystemUserService($systemUserService);
     $this->manager->setUser($user);
     $mockScreenPermissionService = $this->getMock('ScreenPermissionService', array('getScreenPermissions'));
     $permission = new ResourcePermission(true, false, true, false);
     $module = 'admin';
     $action = 'testAction';
     $roles = array($userRole);
     $mockScreenPermissionService->expects($this->once())->method('getScreenPermissions')->with($module, $action, $roles)->will($this->returnValue($permission));
     $this->manager->setScreenPermissionService($mockScreenPermissionService);
     $result = $this->manager->getScreenPermissions($module, $action);
     $this->assertEquals($permission, $result);
 }
开发者ID:rabbitdigital,项目名称:HRM,代码行数:23,代码来源:BasicUserRoleManagerTest.php


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