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


PHP Permission::setDescription方法代码示例

本文整理汇总了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);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:28,代码来源:PermissionPeer.php

示例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;
 }
开发者ID:jungepiraten,项目名称:vpanel,代码行数:9,代码来源:permission.class.php

示例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;
 }
开发者ID:AdiTal,项目名称:server,代码行数:18,代码来源:Permission.php

示例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;
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:34,代码来源:02_add_special_partner_permissions.php

示例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!
开发者ID:richhl,项目名称:kalturaCE,代码行数:31,代码来源:01_set_partner_service_and_plugin_permissions.php


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