當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserRole::setPermissionNames方法代碼示例

本文整理匯總了PHP中UserRole::setPermissionNames方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserRole::setPermissionNames方法的具體用法?PHP UserRole::setPermissionNames怎麽用?PHP UserRole::setPermissionNames使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserRole的用法示例。


在下文中一共展示了UserRole::setPermissionNames方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: UserRole

$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();
    }
}
$msg = 'Done - ' . ($dryRun ? 'DRY RUN!' : 'REAL RUN!');
KalturaLog::log($msg);
開發者ID:richhl,項目名稱:kalturaCE,代碼行數:31,代碼來源:03_create_base_user_roles.php

示例3: 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

示例4: UserRole

$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();
        if ($key === 'admin') {
            $partner = PartnerPeer::retrieveByPk(-2);
            $partner->setAdminSessionRoleId($newRole->getId());
開發者ID:richhl,項目名稱:kalturaCE,代碼行數:31,代碼來源:01_create_base_admin_console_roles_and_migrate_users.php

示例5: 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


注:本文中的UserRole::setPermissionNames方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。