本文整理汇总了PHP中UserRole::setPartnerId方法的典型用法代码示例。如果您正苦于以下问题:PHP UserRole::setPartnerId方法的具体用法?PHP UserRole::setPartnerId怎么用?PHP UserRole::setPartnerId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserRole
的用法示例。
在下文中一共展示了UserRole::setPartnerId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: UserRole
$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);
echo $msg;
示例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();
示例4: 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;
}