/** * Add entry * * @action add * @param KalturaMediaEntry $entry * @return KalturaMediaEntry */ function addAction(KalturaMediaEntry $entry) { if ($entry->conversionQuality && !$entry->conversionProfileId) { $entry->conversionProfileId = $entry->conversionQuality; } $dbEntry = parent::add($entry, $entry->conversionProfileId); $entryStatus = entryStatus::NO_CONTENT; if (PermissionPeer::isValidForPartner(PermissionName::FEATURE_DRAFT_ENTRY_CONV_PROF_SELECTION, $dbEntry->getPartnerId())) { $entryConversionProfileHasFlavors = myPartnerUtils::entryConversionProfileHasFlavors($dbEntry->getId()); if (!$entryConversionProfileHasFlavors) { // If the entry's conversion profile dones't contain any flavors, mark the entry as READY $entryStatus = entryStatus::READY; } } $dbEntry->setStatus($entryStatus); $dbEntry->save(); $trackEntry = new TrackEntry(); $trackEntry->setEntryId($dbEntry->getId()); $trackEntry->setTrackEventTypeId(TrackEntry::TRACK_ENTRY_EVENT_TYPE_ADD_ENTRY); $trackEntry->setDescription(__METHOD__ . ":" . __LINE__ . "::ENTRY_MEDIA"); TrackEntry::addTrackEntry($trackEntry); myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry, $dbEntry->getPartnerId(), null, null, null, $dbEntry->getId()); $entry->fromObject($dbEntry, $this->getResponseProfile()); return $entry; }
public function initService($serviceId, $serviceName, $actionName) { parent::initService($serviceId, $serviceName, $actionName); if ($this->getPartnerId() > 0 && !PermissionPeer::isValidForPartner(PermissionName::FEATURE_LIVE_CHANNEL, $this->getPartnerId())) { throw new KalturaAPIException(KalturaErrors::SERVICE_FORBIDDEN, $this->serviceName . '->' . $this->actionName); } }
/** * @param CaptionAsset $captionAsset * @param BatchJob $parentJob * @throws kCoreException FILE_NOT_FOUND * @return BatchJob */ public function addParseCaptionAssetJob(CaptionAsset $captionAsset, BatchJob $parentJob = null) { $syncKey = $captionAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET); $fileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($syncKey); if (!$fileSync) { if (!PermissionPeer::isValidForPartner(CaptionPermissionName::IMPORT_REMOTE_CAPTION_FOR_INDEXING, $captionAsset->getPartnerId())) { throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND); } $fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey); if (!$fileSync) { throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND); } $fullPath = myContentStorage::getFSUploadsPath() . '/' . $captionAsset->getId() . '.tmp'; if (!kFile::downloadUrlToFile($fileSync->getExternalUrl($captionAsset->getEntryId()), $fullPath)) { throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND); } kFileSyncUtils::moveFromFile($fullPath, $syncKey, true, false, true); } $jobData = new kParseCaptionAssetJobData(); $jobData->setCaptionAssetId($captionAsset->getId()); $batchJob = null; if ($parentJob) { $batchJob = $parentJob->createChild(); } else { $batchJob = new BatchJob(); $batchJob->setEntryId($captionAsset->getEntryId()); $batchJob->setPartnerId($captionAsset->getPartnerId()); } return kJobsManager::addJob($batchJob, $jobData, CaptionSearchPlugin::getBatchJobTypeCoreValue(CaptionSearchBatchJobType::PARSE_CAPTION_ASSET)); }
public function initService($serviceId, $serviceName, $actionName) { parent::initService($serviceId, $serviceName, $actionName); $this->applyPartnerFilterForClass('LiveChannelSegment'); if (!PermissionPeer::isValidForPartner(PermissionName::FEATURE_LIVE_CHANNEL, $this->getPartnerId())) { throw new KalturaAPIException(KalturaErrors::SERVICE_FORBIDDEN, $this->serviceName . '->' . $this->actionName); } }
/** * @param entry $entry * @return bool true if cuepoints should be copied to given entry */ public function hasPermissionToCopyToEntry(entry $entry) { if (!$entry->getIsTemporary() && PermissionPeer::isValidForPartner(AnnotationCuePointPermissionName::COPY_ANNOTATIONS_TO_CLIP, $entry->getPartnerId())) { return true; } if ($entry->getIsTemporary() && !PermissionPeer::isValidForPartner(AnnotationCuePointPermissionName::DO_NOT_COPY_ANNOTATIONS_TO_TRIMMED_ENTRY, $entry->getPartnerId())) { return true; } return false; }
public function validateForResponseProfile() { if (kEntitlementUtils::getEntitlementEnforcement()) { if (PermissionPeer::isValidForPartner(PermissionName::FEATURE_ENABLE_RESPONSE_PROFILE_USER_CACHE, kCurrentContext::getCurrentPartnerId())) { KalturaResponseProfileCacher::useUserCache(); return; } throw new KalturaAPIException(KalturaErrors::CANNOT_LIST_RELATED_ENTITLED_WHEN_ENTITLEMENT_IS_ENABLE, get_class($this)); } }
public function getListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null) { $permissionFilter = $this->toObject(); $c = new Criteria(); $permissionFilter->attachToCriteria($c); $count = PermissionPeer::doCount($c); $pager->attachToCriteria($c); $list = PermissionPeer::doSelect($c); $response = new KalturaPermissionListResponse(); $response->objects = KalturaPermissionArray::fromDbArray($list, $responseProfile); $response->totalCount = $count; return $response; }
private function saveIfShouldScan($flavorAsset) { if (!PermissionPeer::isAllowedPlugin(VirusScanPlugin::PLUGIN_NAME, $flavorAsset->getPartnerId())) { return false; } if (isset(self::$flavorAssetIdsToScan[$flavorAsset->getId()])) { return true; } $profile = VirusScanProfilePeer::getSuitableProfile($flavorAsset->getEntryId()); if ($profile) { self::$flavorAssetIdsToScan[$flavorAsset->getId()] = $profile; return true; } return false; }
public function attachToFinalCriteria(Criteria $criteria) { if (!is_null($this->get('_partner_permissions_exist'))) { if (is_null($this->get('_in_id'))) { $mandatoryParameter = "_in_id"; throw new kCoreException("Mandatory parameter {$mandatoryParameter} missing from the filter", kCoreException::MISSING_MANDATORY_PARAMETERS, $mandatoryParameter); } $permissions = explode(',', $this->get('_partner_permissions_exist')); $tmpCriteria = new Criteria(); $tmpCriteria->addSelectColumn(PermissionPeer::PARTNER_ID); $tmpCriteria->addAnd(PermissionPeer::NAME, $permissions, Criteria::IN); $ids = explode(',', $this->get('_in_id')); $tmpCriteria->addAnd(PermissionPeer::PARTNER_ID, $ids, Criteria::IN); $tmpCriteria->addAnd(PermissionPeer::STATUS, PermissionStatus::ACTIVE, Criteria::EQUAL); $stmt = PermissionPeer::doSelectStmt($tmpCriteria); $this->setIdIn($stmt->fetchAll(PDO::FETCH_COLUMN)); $this->unsetByName('_partner_permissions_exist'); } return parent::attachToFinalCriteria($criteria); }
/** * Cleans up the environment after running a test. */ protected function tearDown() { UserRolePeer::clearInstancePool(); PermissionPeer::clearInstancePool(); PermissionItemPeer::clearInstancePool(); kuserPeer::clearInstancePool(); PartnerPeer::clearInstancePool(); $this->client = null; PermissionItemPeer::setUseCriteriaFilter(false); foreach ($this->addedPermissionItemIds as $id) { try { $obj = PermissionItemPeer::retrieveByPK($id); if ($obj) { $obj->delete(); } } catch (PropelException $e) { } } PermissionItemPeer::setUseCriteriaFilter(true); $this->addedPermissionItemIds = array(); parent::tearDown(); }
/** * Get the [permission_names] column value. * If set to self::ALL_PARTNER_PERMISSIONS_WILDCARD (*), return all permisisons relevant for the partner. * @var bool $filterDependencies true if should filter permissions which are set for partner but not valid due to dependencies on other permissions which are missing for the partner * @return string */ public function getPermissionNames($filterDependencies = false, $skipTranslateWildcard = false) { // get from DB $permissionNames = parent::getPermissionNames(); $permissionNames = array_map('trim', explode(',', $permissionNames)); $currentPartnerId = kCurrentContext::$ks_partner_id; if (is_null($currentPartnerId) || $currentPartnerId === '') { $currentPartnerId = kCurrentContext::$partner_id; } // translate * to permission names of all permissions valid for partner if (in_array(self::ALL_PARTNER_PERMISSIONS_WILDCARD, $permissionNames) && !$skipTranslateWildcard) { $permissionNames = array(); $permissions = PermissionPeer::getAllValidForPartner($currentPartnerId, $filterDependencies); foreach ($permissions as $permission) { $permissionNames[$permission->getName()] = $permission->getName(); } } $permissionNames = implode(',', $permissionNames); if ($filterDependencies) { $permissionNames = PermissionPeer::filterDependenciesByNames($permissionNames, $currentPartnerId); } return $permissionNames; }
public function executeShow(sfWebRequest $request) { $this->role = RolePeer::retrieveByPk($request->getParameter('id')); $this->forward404Unless($this->role); # get all rights $permissions = PermissionPeer::getForSelect(); # get assigned rights $rp_list = RolePermissionPeer::getByRoleId($this->role->getId()); $assoc_perms = array(); foreach ($rp_list as $rp) { $assoc_perms[] = $rp->getPermissionId(); } $this->assoc_perms = $assoc_perms; # prepare widget $this->widget = new sfWidgetFormSelectDoubleList(array('choices' => $permissions, 'label_unassociated' => 'Full List', 'label_associated' => 'Rights Assigned to Role', 'class' => 'security', 'associate' => 'lt;', 'unassociate' => 'gt;', 'unassociate_class' => 'btn-left', 'template' => <<<EOF <div class="%class%" style="padding-top: 0px;"> <div class="holder"> <h4>%label_unassociated%</h4> %unassociated% </div> <ul class="btn-switch"> <li>%associate%</li> <li>%unassociate%</li> </ul> <div class="holder"> <h4>%label_associated%</h4> %associated% </div> <br style="clear: both" /> <script type="text/javascript"> sfDoubleList.init(document.getElementById('%id%'), '%class_select%'); </script> </div> EOF )); }
public function renderEntry($entry) { if (!$entry instanceof entry) { return ""; } $entry_id = $entry->getId(); $kaltura_elements = "<kaltura:entryId>" . $entry->getId() . "</kaltura:entryId>"; if (isset(kCurrentContext::$partner_id) && !PermissionPeer::isValidForPartner(PermissionName::FEATURE_HIDE_SENSITIVE_DATA_IN_RSS_FEED, kCurrentContext::$partner_id)) { $kaltura_elements .= "<kaltura:views>" . ($entry->getViews() ? $entry->getViews() : "0") . "</kaltura:views>" . "<kaltura:plays>" . ($entry->getPlays() ? $entry->getPlays() : "0") . "</kaltura:plays>" . "<kaltura:userScreenName>" . $entry->getUserScreenName() . "</kaltura:userScreenName>" . "<kaltura:puserId>" . $entry->getPuserId() . "</kaltura:puserId>" . "<kaltura:userLandingPage>" . $entry->getUserLandingPage() . "</kaltura:userLandingPage>"; } else { $kaltura_elements .= "<kaltura:views>0</kaltura:views>" . "<kaltura:plays>0</kaltura:plays>" . "<kaltura:userScreenName></kaltura:userScreenName>" . "<kaltura:puserId></kaltura:puserId>" . "<kaltura:userLandingPage></kaltura:userLandingPage>"; } $kaltura_elements .= "<kaltura:partnerLandingPage>" . $entry->getPartnerLandingPage() . "</kaltura:partnerLandingPage>" . "<kaltura:tags>" . $entry->getTags() . "</kaltura:tags>" . "<kaltura:adminTags>" . $entry->getAdminTags() . "</kaltura:adminTags>" . "<kaltura:votes>" . ($entry->getVotes() ? $entry->getVotes() : "0") . "</kaltura:votes>" . "<kaltura:rank>" . ($entry->getRank() ? $entry->getRank() : "0") . "</kaltura:rank>" . "<kaltura:createdAt>" . $entry->getCreatedAt() . "</kaltura:createdAt>" . "<kaltura:createdAtInt>" . $entry->getCreatedAt(null) . "</kaltura:createdAtInt>" . "<kaltura:sourceLink>" . $entry->getSourceLink() . "</kaltura:sourceLink>" . "<kaltura:credit>" . $entry->getCredit() . "</kaltura:credit>"; if ($this->type == self::TYPE_TABOOLA) { // TODO - use entry->getDisplayScope(); $taboola_elements = $entry->getDisplayInSearch() >= 2 ? "<tv:label>_KN_</tv:label>" . "<tv:uploader>" . $entry->getPartnerId() . "</tv:uploader>" : ''; } else { $taboola_elements = ""; } // for now the partner_id & entry_id are set in the guid elementy of the item.. // TODO - move the partner_id to be part of the primary key of the entry so entry will not appear in wrong partners $mrss = '<item>' . '<description>Kaltura Item</description>' . '<guid isPermaLink="false">' . $entry->getPartnerId() . "|" . $entry_id . '</guid>' . '<link>' . $entry->getPartnerLandingPage() . '</link>' . '<pubDate>' . $entry->getCreatedAt() . '</pubDate>' . '<media:content ' . 'url="' . $entry->getDataUrl() . '/ext/flv" ' . ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_VIDEO ? 'type="video/x-flv" ' : ' ') . 'medium="' . $entry->getTypeAsString() . '" ' . 'duration="' . (int) ($entry->getLengthInMsecs() / 1000) . '" ' . 'lang="en"' . '/> ' . '<media:title type="plain">' . kString::xmlEncode($entry->getName()) . "</media:title>" . '<media:description>' . kString::xmlEncode($entry->getDescription()) . '</media:description>' . '<media:keywords>' . kString::xmlEncode($entry->getSearchText()) . '</media:keywords>' . '<media:thumbnail url="' . $entry->getThumbnailUrl() . '/width/640/height/480"/>' . '<media:credit role="kaltura partner">' . $entry->getPartnerId() . '</media:credit>' . $kaltura_elements . $taboola_elements . '</item>'; return $mrss; }
/** * Enable user login * @param string $loginId * @param string $password * @param bool $checkPasswordStructure * @throws kUserException::USER_LOGIN_ALREADY_ENABLED * @throws kUserException::INVALID_EMAIL * @throws kUserException::INVALID_PARTNER * @throws kUserException::ADMIN_LOGIN_USERS_QUOTA_EXCEEDED * @throws kUserException::PASSWORD_STRUCTURE_INVALID * @throws kUserException::LOGIN_ID_ALREADY_USED */ public function enableLogin($loginId, $password = null, $checkPasswordStructure = true, $sendEmail = null) { if (!$password) { $password = UserLoginDataPeer::generateNewPassword(); if (is_null($sendEmail)) { $sendEmail = true; } } if ($this->getLoginDataId()) { throw new kUserException('', kUserException::USER_LOGIN_ALREADY_ENABLED); } $loginDataExisted = null; $loginData = UserLoginDataPeer::addLoginData($loginId, $password, $this->getPartnerId(), $this->getFirstName(), $this->getLastName(), $this->getIsAdmin(), $checkPasswordStructure, $loginDataExisted); if (!$loginData) { throw new kUserException('', kUserException::LOGIN_DATA_NOT_FOUND); } $this->setLoginDataId($loginData->getId()); //Email notification on user creation is sent while using kuser email so make sure this field is set before enabling login //if not than set the email to be the $loginId provided to this action (we now know this is a valid email since "addLoginData" verifies this) if (!$this->getEmail()) { $this->setEmail($loginId); } if ($sendEmail) { if ($loginDataExisted) { kuserPeer::sendNewUserMail($this, true); } else { kuserPeer::sendNewUserMail($this, false); } if (!PermissionPeer::isValidForPartner(PermissionName::FEATURE_DISABLE_NEW_USER_EMAIL, $this->getPartnerId())) { kuserPeer::sendNewUserMailToAdmins($this); } } return $this; }
* @subpackage dragonfly.roles_and_permissions * * Populate permission table with all base permissions * * No need to re-run after server code depoloy * In order to re-run delete from permission */ $dryRun = true; //TODO: change for real run if ($argc > 1 && $argv[1] == 'realrun') { $dryRun = false; } //------------------------------------------------------ require_once dirname(__FILE__) . '/../../../bootstrap.php'; //------------------------------------------------------ $permissionsData = array(array(-1, PermissionType::NORMAL, PermissionName::BATCH_BASE, 'Batch system permission', null), array(0, PermissionType::NORMAL, PermissionName::USER_SESSION_PERMISSION, 'User session permission', null), array(0, PermissionType::NORMAL, PermissionName::ALWAYS_ALLOWED_ACTIONS, 'No session permission', null), array(0, PermissionType::NORMAL, PermissionName::CONTENT_INGEST_UPLOAD, 'Upload', null), array(0, PermissionType::NORMAL, PermissionName::CONTENT_INGEST_BULK_UPLOAD, 'Bulk upload', null), array(0, PermissionType::NORMAL, PermissionName::CONTENT_INGEST_FEED, 'Feed subscription', null), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MANAGE_MIX, 'Manage remix', null), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MANAGE_BASE, 'Basic content management', null), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MANAGE_METADATA, 'Modify metadata', null), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MANAGE_ASSIGN_CATEGORIES, 'Assign categories', null), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MANAGE_THUMBNAIL, 'Modify thumbnails', null), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MANAGE_SCHEDULE, 'Modify scheduling', null), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MANAGE_ACCESS_CONTROL, 'Modify content access control', null), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MANAGE_CUSTOM_DATA, 'Modify custom data', PermissionPeer::getPermissionNameFromPluginName(MetadataPlugin::getPluginName())), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MANAGE_DELETE, 'Delete content', null), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MANAGE_RECONVERT, 'Reconvert flavors', null), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MANAGE_EDIT_CATEGORIES, 'Manage categories', null), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MANAGE_EMBED_CODE, 'Grab embed code', null), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MANAGE_DISTRIBUTION_BASE, 'Distribution base', PermissionPeer::getPermissionNameFromPluginName(ContentDistributionPlugin::getPluginName())), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MANAGE_DISTRIBUTION_WHERE, 'Where to distribute', PermissionPeer::getPermissionNameFromPluginName(ContentDistributionPlugin::getPluginName())), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MANAGE_DISTRIBUTION_SEND, 'Distribution submit', PermissionPeer::getPermissionNameFromPluginName(ContentDistributionPlugin::getPluginName())), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MANAGE_DISTRIBUTION_REMOVE, 'Distribution remove', PermissionPeer::getPermissionNameFromPluginName(ContentDistributionPlugin::getPluginName())), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MANAGE_DISTRIBUTION_PROFILE_MODIFY, 'Distribution profile manage', PermissionPeer::getPermissionNameFromPluginName(ContentDistributionPlugin::getPluginName())), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MANAGE_VIRUS_SCAN, 'Virus scan actions', PermissionPeer::getPermissionNameFromPluginName(VirusScanPlugin::getPluginName())), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MANAGE_DOWNLOAD, 'Content download', null), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MANAGE_ANNOTATION, 'Annotate', PermissionPeer::getPermissionNameFromPluginName(AnnotationPlugin::getPluginName())), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MANAGE_SHARE, 'Share content', null), array(0, PermissionType::NORMAL, PermissionName::LIVE_STREAM_ADD, 'Add live streams', PermissionName::FEATURE_LIVE_STREAM), array(0, PermissionType::NORMAL, PermissionName::LIVE_STREAM_UPDATE, 'Modify live streams', PermissionName::FEATURE_LIVE_STREAM), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MODERATE_BASE, 'Basic moderation', null), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MODERATE_METADATA, 'Moderate metadata', null), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MODERATE_CUSTOM_DATA, 'Moderate custom data', PermissionPeer::getPermissionNameFromPluginName(MetadataPlugin::getPluginName())), array(0, PermissionType::NORMAL, PermissionName::CONTENT_MODERATE_APPROVE_REJECT, 'Approve/Reject content', null), array(0, PermissionType::NORMAL, PermissionName::PLAYLIST_BASE, 'Playlist access', null), array(0, PermissionType::NORMAL, PermissionName::PLAYLIST_ADD, 'Add playlists', null), array(0, PermissionType::NORMAL, PermissionName::PLAYLIST_UPDATE, 'Modify playlists', null), array(0, PermissionType::NORMAL, PermissionName::PLAYLIST_DELETE, 'Delete playlists', null), array(0, PermissionType::NORMAL, PermissionName::PLAYLIST_EMBED_CODE, 'Grab playlist embed code', null), array(0, PermissionType::NORMAL, PermissionName::SYNDICATION_BASE, 'Syndication feeds access', null), array(0, PermissionType::NORMAL, PermissionName::SYNDICATION_ADD, 'Create syndication feeds', null), array(0, PermissionType::NORMAL, PermissionName::SYNDICATION_UPDATE, 'Modify syndication feeds', null), array(0, PermissionType::NORMAL, PermissionName::SYNDICATION_DELETE, 'Delete syndication feeds', null), array(0, PermissionType::NORMAL, PermissionName::STUDIO_BASE, 'Appstudio access', null), array(0, PermissionType::NORMAL, PermissionName::STUDIO_ADD_UICONF, 'Create players', null), array(0, PermissionType::NORMAL, PermissionName::STUDIO_UPDATE_UICONF, 'Modify players', null), array(0, PermissionType::NORMAL, PermissionName::STUDIO_DELETE_UICONF, 'Delete players', null), array(0, PermissionType::NORMAL, PermissionName::STUDIO_BRAND_UICONF, 'Set player branding', null), array(0, PermissionType::NORMAL, PermissionName::STUDIO_SELECT_CONTENT, 'Select player content', null), array(0, PermissionType::NORMAL, PermissionName::ADVERTISING_BASE, 'Advertising access', null), array(0, PermissionType::NORMAL, PermissionName::ADVERTISING_UPDATE_SETTINGS, 'Modify advertising settings', null), array(0, PermissionType::NORMAL, PermissionName::ACCOUNT_BASE, 'Account settings access', null), array(0, PermissionType::NORMAL, PermissionName::ACCOUNT_UPDATE_SETTINGS, 'Modify account settings', null), array(0, PermissionType::NORMAL, PermissionName::INTEGRATION_BASE, 'Integration settings access', null), array(0, PermissionType::NORMAL, PermissionName::INTEGRATION_UPDATE_SETTINGS, 'Modify integration settings', null), array(0, PermissionType::NORMAL, PermissionName::ACCESS_CONTROL_BASE, 'Access control profiles access', null), array(0, PermissionType::NORMAL, PermissionName::ACCESS_CONTROL_ADD, 'Create access control profiles', null), array(0, PermissionType::NORMAL, PermissionName::ACCESS_CONTROL_UPDATE, 'Modify access control profiles', null), array(0, PermissionType::NORMAL, PermissionName::ACCESS_CONTROL_DELETE, 'Delete access control profiles', null), array(0, PermissionType::NORMAL, PermissionName::TRANSCODING_BASE, 'Transcoding profiles access', null), array(0, PermissionType::NORMAL, PermissionName::TRANSCODING_ADD, 'Create transcoding profiles', null), array(0, PermissionType::NORMAL, PermissionName::TRANSCODING_UPDATE, 'Modify transcoding profiles', null), array(0, PermissionType::NORMAL, PermissionName::TRANSCODING_DELETE, 'Delete transcoding profiles', null), array(0, PermissionType::NORMAL, PermissionName::CUSTOM_DATA_PROFILE_BASE, 'Custom data access', PermissionPeer::getPermissionNameFromPluginName(MetadataPlugin::getPluginName())), array(0, PermissionType::NORMAL, PermissionName::CUSTOM_DATA_PROFILE_ADD, 'Create custom data', PermissionPeer::getPermissionNameFromPluginName(MetadataPlugin::getPluginName())), array(0, PermissionType::NORMAL, PermissionName::CUSTOM_DATA_PROFILE_UPDATE, 'Modify custom data', PermissionPeer::getPermissionNameFromPluginName(MetadataPlugin::getPluginName())), array(0, PermissionType::NORMAL, PermissionName::CUSTOM_DATA_PROFILE_DELETE, 'Delete custom data', PermissionPeer::getPermissionNameFromPluginName(MetadataPlugin::getPluginName())), array(0, PermissionType::NORMAL, PermissionName::ADMIN_BASE, 'Administration settings access', null), array(0, PermissionType::NORMAL, PermissionName::ADMIN_USER_ADD, 'Add users', null), array(0, PermissionType::NORMAL, PermissionName::ADMIN_USER_UPDATE, 'Modify users', null), array(0, PermissionType::NORMAL, PermissionName::ADMIN_USER_DELETE, 'Delete users', null), array(0, PermissionType::NORMAL, PermissionName::ADMIN_ROLE_ADD, 'Add roles', null), array(0, PermissionType::NORMAL, PermissionName::ADMIN_ROLE_UPDATE, 'Modify roles', null), array(0, PermissionType::NORMAL, PermissionName::ADMIN_ROLE_DELETE, 'Delete roles', null), array(0, PermissionType::NORMAL, PermissionName::ADMIN_PUBLISHER_MANAGE, 'Manage publishers', null), array(0, PermissionType::NORMAL, PermissionName::ADMIN_WHITE_BRANDING, 'Manage whitebranding', null), array(0, PermissionType::NORMAL, PermissionName::ANALYTICS_BASE, 'Analytics access', PermissionName::FEATURE_ANALYTICS_TAB), array(0, PermissionType::NORMAL, PermissionName::WIDGET_ADMIN, 'Widget admin', null), array(0, PermissionType::NORMAL, PermissionName::ANALYTICS_SEND_DATA, 'Send analytics data', null), array(0, PermissionType::NORMAL, PermissionName::WIDGET_ADMIN, 'Widget admin', null), array(0, PermissionType::NORMAL, PermissionName::SEARCH_SERVICE, 'Search service', null), array(0, PermissionType::NORMAL, PermissionName::ANALYTICS_SEND_DATA, 'Send analytics data', null), array(0, PermissionType::NORMAL, PermissionName::AUDIT_TRAIL_BASE, 'Audit trail base', PermissionPeer::getPermissionNameFromPluginName(AuditPlugin::getPluginName())), array(0, PermissionType::NORMAL, PermissionName::AUDIT_TRAIL_ADD, 'Audit trail add', PermissionPeer::getPermissionNameFromPluginName(AuditPlugin::getPluginName())), array(0, PermissionType::NORMAL, PermissionName::KMC_ACCESS, 'KMC access', null), array(0, PermissionType::NORMAL, PermissionName::KMC_READ_ONLY, 'KMC access', PermissionName::KMC_ACCESS), array(0, PermissionType::NORMAL, PermissionName::CUSTOM_DATA_FIELD_ADD, 'Add custom data field', null), array(0, PermissionType::NORMAL, PermissionName::CUSTOM_DATA_FIELD_UPDATE, 'Update custom data field', null), array(0, PermissionType::NORMAL, PermissionName::CUSTOM_DATA_FIELD_DELETE, 'Delete custom data field', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_BASE, 'Base system admin permission', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_PUBLISHER_BASE, 'Base system admin permission', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_PUBLISHER_KMC_ACCESS, 'Base system admin permission', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_PUBLISHER_CONFIG, 'Base system admin permission', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_PUBLISHER_BLOCK, 'Base system admin permission', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_PUBLISHER_REMOVE, 'Base system admin permission', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_PUBLISHER_ADD, 'Base system admin permission', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_PUBLISHER_USAGE, 'Base system admin permission', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_USER_MANAGE, 'Base system admin permission', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_SYSTEM_MONITOR, 'Base system admin permission', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_DEVELOPERS_TAB, 'Base system admin permission', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_BATCH_CONTROL, 'Base system admin permission', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_BATCH_CONTROL_INPROGRESS, 'Base system admin permission', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_BATCH_CONTROL_FAILED, 'Base system admin permission', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_BATCH_CONTROL_SETUP, 'Base system admin permission', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_STORAGE, 'Base system admin permission', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_VIRUS_SCAN, 'Base system admin permission', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_EMAIL_INGESTION, 'Base system admin permission', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_CONTENT_DISTRIBUTION_BASE, 'Base system admin permission', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_CONTENT_DISTRIBUTION_MODIFY, 'Base system admin permission', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_PERMISSIONS_MANAGE, 'Base system admin permission', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_INTERNAL, 'System internal actions', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_ADMIN_ENTRY_INVESTIGATION, 'Entry investigation', null), array(-2, PermissionType::NORMAL, PermissionName::SYSTEM_FILESYNC, 'Filesync actions', null), array(99, PermissionType::SPECIAL_FEATURE, PermissionName::FEATURE_PS2_PERMISSIONS_VALIDATION, 'PS2 permissions validation', null)); //------------------------------------------------------ $allPermissions = array(); foreach ($permissionsData as $data) { $permission = new Permission(); $permission->setPartnerId($data[0]); $permission->setType($data[1]); $permission->setName($data[2]); $permission->setFriendlyName($data[3]); $permission->setDependsOnPermissionNames($data[4]); $permission->setStatus(PermissionStatus::ACTIVE); $allPermissions[] = $permission; } //------------------------------------------------------ foreach ($allPermissions as $permission) { if ($dryRun) {
public function validateForResponseProfile() { if (PermissionPeer::isValidForPartner(PermissionName::FEATURE_ENABLE_RESPONSE_PROFILE_USER_CACHE, kCurrentContext::getCurrentPartnerId())) { return; } if (kEntitlementUtils::getEntitlementEnforcement()) { throw new KalturaAPIException(KalturaErrors::CANNOT_LIST_RELATED_ENTITLED_WHEN_ENTITLEMENT_IS_ENABLE, get_class($this)); } if (!kCurrentContext::$is_admin_session && !$this->idEqual && !$this->idIn && !$this->referenceIdEqual && !$this->redirectFromEntryId && !$this->referenceIdIn && !$this->parentEntryIdEqual) { if (kCurrentContext::$ks_object->privileges === ks::PATTERN_WILDCARD) { return; } if (kCurrentContext::$ks_object->getPrivilegeValue(ks::PRIVILEGE_LIST) === ks::PATTERN_WILDCARD) { return; } throw new KalturaAPIException(KalturaErrors::USER_KS_CANNOT_LIST_RELATED_ENTRIES, get_class($this)); } }
/** * Populates the object using an array. * * This is particularly useful when populating an object from one of the * request arrays (e.g. $_POST). This method goes through the column * names, checking to see whether a matching key exists in populated * array. If so the setByName() method is called for that column. * * You can specify the key type of the array by additionally passing one * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. * The default key type is the column's phpname (e.g. 'AuthorId') * * @param array $arr An array to populate the object from. * @param string $keyType The type of keys the array uses. * @return void */ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = PermissionPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setType($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setName($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setFriendlyName($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setDescription($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setPartnerId($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setStatus($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setDependsOnPermissionNames($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setTags($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setCreatedAt($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setUpdatedAt($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setCustomData($arr[$keys[11]]); } }
protected function invalidateCachedRelatedObjects(IRelatedObject $object) { self::invalidateRelated($object); if (PermissionPeer::isValidForPartner(PermissionName::FEATURE_RECALCULATE_RESPONSE_PROFILE_CACHE, $object->getPartnerId())) { $this->addRecalculateRelatedObjectsCacheJob($object); } return true; }
/** * Description : This method delete the permission in database * * @param Permission $permission : Permission object * @return : Returns true if the object was deleted */ public function deletePermission($permission) { try { return PermissionPeer::doDelete($permission); } catch (Exception $e) { return null; } }
function addItemToPermissions($item, $permissionNames, $partnerId) { foreach ($permissionNames as $permissionName) { PermissionToPermissionItemPeer::clearInstancePool(); $partnerPermission = array_map('trim', explode('>', $permissionName)); if (count($partnerPermission) === 2) { $partnerId = trim($partnerPermission[0]); } $permissionName = trim(end($partnerPermission)); $c = new Criteria(); $c->addAnd(PermissionPeer::NAME, $permissionName, Criteria::EQUAL); $c->addAnd(PermissionPeer::TYPE, array(PermissionType::NORMAL, PermissionType::PARTNER_GROUP), Criteria::IN); $c->addAnd(PermissionPeer::PARTNER_ID, array(PartnerPeer::GLOBAL_PARTNER, $item->getPartnerId(), $partnerId), Criteria::IN); $permission = PermissionPeer::doSelectOne($c); if (!$permission) { KalturaLog::alert('ERROR - Permission name [' . $permissionName . '] for partner [' . $item->getPartnerId() . '] not found in database - skipping!'); continue; } KalturaLog::log('Adding permission item id [' . $item->getId() . '] to permission id [' . $permission->getId() . ']'); $permission->addPermissionItem($item->getId(), true); } }
/** * Get the external FileSync object by its key and statuses * * @param FileSyncKey $key * @param int $externalStorageId * @param array $statuses an array of required status values * @return FileSync */ protected static function getExternalFileSyncForKeyByStatus(FileSyncKey $key, $externalStorageId = null, $statuses = array()) { if (is_null($key->partner_id)) { throw new kFileSyncException("partner id not defined for key [{$key}]", kFileSyncException::FILE_SYNC_PARTNER_ID_NOT_DEFINED); } self::prepareStorageProfilesForSort($key->partner_id); $c = new Criteria(); $c = FileSyncPeer::getCriteriaForFileSyncKey($key); if (is_null($externalStorageId)) { $c->addAnd(FileSyncPeer::FILE_TYPE, FileSync::FILE_SYNC_FILE_TYPE_URL); // any external $c->addAnd(FileSyncPeer::DC, self::$storageProfilesOrder, Criteria::IN); } else { $c->addAnd(FileSyncPeer::DC, $externalStorageId); } if (!empty($statuses)) { $c->addAnd(FileSyncPeer::STATUS, $statuses, Criteria::IN); } if (!PermissionPeer::isValidForPartner(PermissionName::FEATURE_REMOTE_STORAGE_DELIVERY_PRIORITY, $key->partner_id)) { return FileSyncPeer::doSelectOne($c); } $fileSyncs = FileSyncPeer::doSelect($c); if (count($fileSyncs) > 1) { uasort($fileSyncs, array('self', 'compareStorageProfiles')); } return reset($fileSyncs); }
public function execute() { // Disable layout $this->setLayout(false); $this->success = false; $this->type = $this->getRequestParameter('type'); if (!$this->type) { KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'type'); } $validTypes = array('name', 'email', 'password'); if (!in_array($this->type, $validTypes)) { KExternalErrors::dieError(KExternalErrors::INVALID_SETTING_TYPE); } $ks = $this->getP("kmcks"); if (!$ks) { KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'ks'); } // Get partner & user info from KS $ksObj = kSessionUtils::crackKs($ks); $partnerId = $ksObj->partner_id; $userId = $ksObj->user; $partner = PartnerPeer::retrieveByPK($partnerId); if (!$partner) { KExternalErrors::dieError(KExternalErrors::PARTNER_NOT_FOUND); } if (!$partner->validateApiAccessControl()) { KExternalErrors::dieError(KExternalErrors::SERVICE_ACCESS_CONTROL_RESTRICTED); } $this->forceKMCHttps = PermissionPeer::isValidForPartner(PermissionName::FEATURE_KMC_ENFORCE_HTTPS, $partnerId); if ($this->forceKMCHttps) { // Prevent the page fron being embeded in an iframe header('X-Frame-Options: SAMEORIGIN'); } if ($this->forceKMCHttps && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')) { die; } // Load the current user $dbUser = kuserPeer::getKuserByPartnerAndUid($partnerId, $userId); if (!$dbUser) { KExternalErrors::dieError('INVALID_USER_ID', $userId); } $this->email = $dbUser->getEmail(); $this->fname = $dbUser->getFirstName(); $this->lname = $dbUser->getLastName(); $this->parent_url = $this->clean($_GET['parent']); // Set page title switch ($this->type) { case 'password': $this->pageTitle = 'Change Password'; break; case 'email': $this->pageTitle = 'Change Email Address'; break; case 'name': $this->pageTitle = 'Change Username'; break; } // select which action to do if (isset($_POST['do'])) { switch ($_POST['do']) { case "password": $this->changePassword(); break; case "email": $this->changeEmail(); break; case "name": $this->changeName(); break; } } sfView::SUCCESS; }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(PermissionPeer::DATABASE_NAME); $criteria->add(PermissionPeer::ID, $pks, Criteria::IN); $objs = PermissionPeer::doSelect($criteria, $con); } return $objs; }
/** * * @param Partner $toPartner * @param array $permissionArray * * @return bool */ public static function isPartnerPermittedForCopy(Partner $toPartner, array $permissionArray) { foreach ($permissionArray as $permission) { if (!PermissionPeer::isValidForPartner($permission, $toPartner->getId())) { return false; } } return true; }
public function validateForResponseProfile() { if (!kCurrentContext::$is_admin_session && !$this->idEqual && !$this->idIn && !$this->systemNameEqual && !$this->systemNameIn && !PermissionPeer::isValidForPartner(PermissionName::FEATURE_ENABLE_RESPONSE_PROFILE_USER_CACHE, kCurrentContext::getCurrentPartnerId())) { throw new KalturaAPIException(KalturaCuePointErrors::USER_KS_CANNOT_LIST_RELATED_CUE_POINTS, get_class($this)); } }
public function objectReplaced(BaseObject $object, BaseObject $replacingObject, BatchJob $raisedJob = null) { //replacement as a result of convertLiveSegmentFinished if (!$replacingObject->getIsTemporary()) { return true; } $c = new Criteria(); $c->add(CuePointPeer::ENTRY_ID, $object->getId()); if (CuePointPeer::doCount($c) > self::MAX_CUE_POINTS_TO_COPY_TO_CLIP) { KalturaLog::alert("Can't handle cuePoints after replacement for entry [{$object->getId()}] because cuePoints count exceeded max limit of [" . self::MAX_CUE_POINTS_TO_COPY_TO_CLIP . "]"); return true; } $clipAttributes = self::getClipAttributesFromEntry($replacingObject); //replacement as a result of trimming if (!is_null($clipAttributes)) { kEventsManager::setForceDeferredEvents(true); $this->deleteCuePoints($c); //copy cuepoints from replacement entry $replacementCuePoints = CuePointPeer::retrieveByEntryId($replacingObject->getId()); foreach ($replacementCuePoints as $cuePoint) { $newCuePoint = $cuePoint->copyToEntry($object); $newCuePoint->save(); } kEventsManager::flushEvents(); } else { if (PermissionPeer::isValidForPartner(CuePointPermissionName::REMOVE_CUE_POINTS_WHEN_REPLACING_MEDIA, $object->getPartnerId())) { $this->deleteCuePoints($c); } } return true; }
/** * Updates an existing user role object. * * @action update * @param int $userRoleId The user role's unique identifier * @param KalturaUserRole $userRole The user role's unique identifier * @return KalturaUserRole The updated user role object * * @throws KalturaErrors::INVALID_OBJECT_ID * @throws KalturaErrors::PERMISSION_NOT_FOUND */ public function updateAction($userRoleId, KalturaUserRole $userRole) { /* critera is used here instead of retrieveByPk on purpose! if the current context is assigned to a partner 0 role, then retrieveByPk will return it from cache even though partner 0 is not in the partner group for the current action and context */ $c = new Criteria(); $c->addAnd(UserRolePeer::ID, $userRoleId, Criteria::EQUAL); if ($this->partnerGroup() != myPartnerUtils::ALL_PARTNERS_WILD_CHAR) { $c->addAnd(UserRolePeer::PARTNER_ID, explode(',', $this->partnerGroup()), Criteria::IN); } $dbUserRole = UserRolePeer::doSelectOne($c); if (!$dbUserRole) { throw new KalturaAPIException(KalturaErrors::INVALID_OBJECT_ID, $userRoleId); } // cannot update name to a name that already exists if ($userRole->name && $userRole->name != $dbUserRole->getName()) { if (UserRolePeer::getByNameAndPartnerId($userRole->name, $this->getPartnerId())) { throw new KalturaAPIException(KalturaErrors::ROLE_NAME_ALREADY_EXISTS); } } if (!is_null($userRole->permissionNames) && !$userRole->permissionNames instanceof KalturaNullField) { try { PermissionPeer::checkValidPermissionsForRole($userRole->permissionNames, $this->getPartnerId()); } catch (kPermissionException $e) { $code = $e->getCode(); if ($code == kPermissionException::PERMISSION_NOT_FOUND) { throw new KalturaAPIException(KalturaErrors::PERMISSION_NOT_FOUND, $e->getMessage()); } } } $dbUserRole = $userRole->toUpdatableObject($dbUserRole); $dbUserRole->save(); $userRole = new KalturaUserRole(); $userRole->fromObject($dbUserRole, $this->getResponseProfile()); return $userRole; }
/** * Validate if the entry should be exported to the remote storage according to the defined export rules * * @param kStorageProfileScope $scope */ public function fulfillsRules(kStorageProfileScope $scope) { if (!PermissionPeer::isValidForPartner(PermissionName::FEATURE_REMOTE_STORAGE_RULE, $this->getPartnerId())) { return true; } if (!is_array($this->getRules()) || !count($this->getRules())) { return true; } $context = null; if (!array_key_exists($this->getId(), kStorageExporter::$entryContextDataResult)) { kStorageExporter::$entryContextDataResult[$this->getId()] = array(); } if (array_key_exists($scope->getEntryId(), kStorageExporter::$entryContextDataResult[$this->getId()])) { KalturaLog::debug("Found rule->applyContext result in cache"); $context = kStorageExporter::$entryContextDataResult[$this->getId()][$scope->getEntryId()]; } else { KalturaLog::debug("Validating rules"); $context = new kContextDataResult(); foreach ($this->getRules() as $rule) { /* @var $rule kRule */ $rule->setScope($scope); $fulfilled = $rule->applyContext($context); if ($fulfilled && $rule->getStopProcessing()) { break; } } kStorageExporter::$entryContextDataResult[$this->getId()][$scope->getEntryId()] = $context; } foreach ($context->getActions() as $action) { /* @var $action kRuleAction */ if ($action->getType() == RuleActionType::ADD_TO_STORAGE) { return true; } } return false; }
public function getCategoriesIds() { if (PermissionPeer::isValidForPartner(PermissionName::FEATURE_DISABLE_CATEGORY_LIMIT, $this->getPartnerId())) { return null; } return parent::getCategoriesIds(); }
$subPartnerId = $argv[1]; $masterPartnerId = $argv[2]; $subPartner = PartnerPeer::retrieveByPK($subPartnerId); if (!$subPartner) { die("no such sub partner [{$subPartner}]." . PHP_EOL); } $masterPartner = PartnerPeer::retrieveByPK($masterPartnerId); if (!$masterPartner) { die("no such master partner [{$subPartner}]." . PHP_EOL); } PermissionPeer::clearInstancePool(); $c = new Criteria(); $c->addAnd(PermissionPeer::PARTNER_ID, $masterPartner->getId(), Criteria::EQUAL); $c->addAnd(PermissionPeer::TYPE, PermissionType::PARTNER_GROUP, Criteria::EQUAL); $c->addAnd(PermissionPeer::STATUS, PermissionStatus::ACTIVE, Criteria::EQUAL); $permission = PermissionPeer::doSelectOne($c); if (!$permission) { die("Master partner group doesnot exists" . PHP_EOL); } $group = $permission->getPartnerGroup(); $groupPartners = explode(',', $group); $newGroupArr = array(); foreach ($groupPartners as $groupPartner) { if ($groupPartner != $subPartnerId) { $newGroupArr[] = $groupPartner; } } $newGroup = implode(',', $newGroupArr); $permission->setPartnerGroup($newGroup); $permission->save(); echo "current partner group [{$newGroup}] " . PHP_EOL;