本文整理汇总了PHP中Permission::setDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP Permission::setDescription方法的具体用法?PHP Permission::setDescription怎么用?PHP Permission::setDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Permission
的用法示例。
在下文中一共展示了Permission::setDescription方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: enableForPartner
public static function enableForPartner($permissionName, $permissionType, $partnerId, $friendlyName = null, $description = null)
{
$permission = new Permission();
$permission->setName($permissionName);
$permission->setFriendlyName($friendlyName ? $friendlyName : $permissionName);
$permission->setDescription($description);
$permission->setType($permissionType);
$permission->setStatus(PermissionStatus::ACTIVE);
try {
// try to add permission
self::addToPartner($permission, $partnerId);
return true;
} catch (kPermissionException $e) {
$code = $e->getCode();
if ($code == kPermissionException::PERMISSION_ALREADY_EXISTS) {
// permission already exists - set status to active
$permission = self::getByNameAndPartner($permissionName, array($partnerId));
if (!$permission) {
throw new kCoreException("Permission [{$permissionName}] not found for partner [{$partnerId}]", kCoreException::INTERNAL_SERVER_ERROR);
}
$permission->setStatus(PermissionStatus::ACTIVE);
$permission->save();
return true;
}
throw $e;
}
throw new kCoreException('Unknown error occured', kCoreException::INTERNAL_SERVER_ERROR);
}
示例2: factory
public static function factory(Storage $storage, $row)
{
$permission = new Permission($storage);
$permission->setPermissionID($row["permissionid"]);
$permission->setLabel($row["label"]);
$permission->setDescription($row["description"]);
$permission->isGlobal($row["global"]);
return $permission;
}
示例3: copyToPartner
/**
* Copy current permission to the given partner.
* @param int $partnerId
*/
public function copyToPartner($partnerId)
{
$permission = new Permission();
$permission->setName($this->getName());
$permission->setFriendlyName($this->getFriendlyName());
$permission->setDescription($this->getDescription());
$permission->setStatus($this->getStatus());
$permission->setTags($this->getTags());
$permission->setType($this->getType());
$permission->setCustomData($this->getCustomData());
$permission->setPartnerId($partnerId);
// set new partner id
return $permission;
}
示例4: getOrCreatePartnerGroupPermission
/**
* Create a special partner group permission for given partner id, or get an existing one
* @param int $partnerId
* @param string $partnerGroup
*/
function getOrCreatePartnerGroupPermission($partnerId, $partnerGroup)
{
$permissionName = 'PARTNER_' . $partnerId . '_GROUP_' . $partnerGroup . '_PERMISSION';
PermissionPeer::clearInstancePool();
$c = new Criteria();
$c->addAnd(PermissionPeer::PARTNER_ID, $partnerId, Criteria::EQUAL);
$c->addAnd(PermissionPeer::NAME, $permissionName, Criteria::EQUAL);
$c->addAnd(PermissionPeer::TYPE, PermissionType::PARTNER_GROUP, Criteria::EQUAL);
$permission = PermissionPeer::doSelectOne($c);
if (!$permission) {
// create permission if not yet created
$permission = new Permission();
$permission->setPartnerId($partnerId);
$permission->setName($permissionName);
$permission->setFriendlyName('Partner ' . $partnerId . ' permission for group ' . $partnerGroup);
$permission->setDescription('Partner ' . $partnerId . ' permission for group ' . $partnerGroup);
$permission->setType(PermissionType::PARTNER_GROUP);
$permission->setPartnerGroup($partnerGroup);
$permission->setStatus(PermissionStatus::ACTIVE);
$permission->save();
} else {
if ($permission->getPartnerGroup() != $partnerGroup) {
$msg = '***** ERROR - Permission id [' . $permission->getId() . '] partner group [' . $permission->getPartnerGroup() . '] is different from the required partner group [' . $partnerGroup . ']';
KalturaLog::alert($msg);
echo $msg . PHP_EOL;
}
}
return $permission;
}
示例5: Permission
$players508Permission->setPartnerId($partner->getId());
$players508Permission->setName(PermissionName::FEATURE_508_PLAYERS);
$players508Permission->setFriendlyName('508 players feature');
$players508Permission->setDescription('Permission to use 508 players');
$players508Permission->setStatus(PermissionStatus::ACTIVE);
$players508Permission->setType(PermissionType::SPECIAL_FEATURE);
$newPermissions[] = $players508Permission;
}
// live stream
$allowedLiveStream = $partner->getFromCustomData("liveEnabled", null, 0);
if ($allowedLiveStream) {
$livePermission = new Permission();
$livePermission->setPartnerId($partner->getId());
$livePermission->setName(PermissionName::FEATURE_LIVE_STREAM);
$livePermission->setFriendlyName('Live stream feature');
$livePermission->setDescription('Permission to use live stream');
$livePermission->setStatus(PermissionStatus::ACTIVE);
$livePermission->setType(PermissionType::SPECIAL_FEATURE);
$newPermissions[] = $livePermission;
}
if (!$dryRun) {
foreach ($newPermissions as $permission) {
KalturaLog::log('SAVING new permission for partner [' . $partner->getId() . ']:');
PermissionPeer::enableForPartner($permission->getName(), $permission->getType(), $partner->getId(), $permission->getFriendlyName(), $permission->getDescription());
KalturaLog::log(print_r($permission, true));
}
} else {
foreach ($newPermissions as $permission) {
KalturaLog::log('DRY RUN ONLY - new permission for partner [' . $partner->getId() . ']:');
KalturaLog::log(print_r($permission, true));
// dry run - no saving!