/**
  * Retrieves a list of permissions that apply to the current KS.
  * 
  * @action getCurrentPermissions
  * 
  * @return string A comma-separated list of current permission names
  * 
  */
 public function getCurrentPermissions()
 {
     $permissions = kPermissionManager::getCurrentPermissions();
     $permissions = implode(',', $permissions);
     return $permissions;
 }
示例#2
0
 /**
  * Retrieves a user object for a user's login ID and partner ID.
  * A login ID is the email address used by a user to log into the system.
  * 
  * @action getByLoginId
  * @param string $loginId The user's email address that identifies the user for login
  * @return KalturaUser The user object represented by the login and partner IDs
  * 
  * @throws KalturaErrors::LOGIN_DATA_NOT_FOUND
  * @throws KalturaErrors::USER_NOT_FOUND
  */
 public function getByLoginIdAction($loginId)
 {
     $loginData = UserLoginDataPeer::getByEmail($loginId);
     if (!$loginData) {
         throw new KalturaAPIException(KalturaErrors::LOGIN_DATA_NOT_FOUND);
     }
     $kuser = kuserPeer::getByLoginDataAndPartner($loginData->getId(), $this->getPartnerId());
     if (!$kuser) {
         throw new KalturaAPIException(KalturaErrors::USER_NOT_FOUND);
     }
     // users that are not publisher administrator are only allowed to get their own object
     if ($kuser->getId() != kCurrentContext::getCurrentKsKuserId() && !in_array(PermissionName::MANAGE_ADMIN_USERS, kPermissionManager::getCurrentPermissions())) {
         throw new KalturaAPIException(KalturaErrors::INVALID_USER_ID, $loginId);
     }
     $user = new KalturaUser();
     $user->fromObject($kuser, $this->getResponseProfile());
     return $user;
 }