Esempio n. 1
0
 public function getAction()
 {
     $user = User::getById(intval($this->_getParam("id")));
     $userObjects = Object_Service::getObjectsReferencingUser($user->getId());
     $userObjectData = array();
     $currentUser = Zend_Registry::get("pimcore_user");
     foreach ($userObjects as $o) {
         $hasHidden = false;
         $o->getUserPermissions($currentUser);
         if ($o->isAllowed("list")) {
             $userObjectData[] = array("path" => $o->getFullPath(), "id" => $o->getId(), "subtype" => $o->getClass()->getName());
         } else {
             $hasHidden = true;
         }
     }
     $user->setPassword(null);
     $conf = Pimcore_Config::getSystemConfig();
     $this->_helper->json(array("wsenabled" => $conf->webservice->enabled, "user" => $user->getIterator(), "objectDependencies" => array("hasHidden" => $hasHidden, "dependencies" => $userObjectData)));
 }
 public function getAction()
 {
     if (intval($this->_getParam("id")) < 1) {
         $this->_helper->json(array("success" => false));
     }
     $user = User::getById(intval($this->_getParam("id")));
     // workspaces
     $types = array("asset", "document", "object");
     foreach ($types as $type) {
         $workspaces = $user->{"getWorkspaces" . ucfirst($type)}();
         foreach ($workspaces as $workspace) {
             $el = Element_Service::getElementById($type, $workspace->getCid());
             if ($el) {
                 // direct injection => not nice but in this case ok ;-)
                 $workspace->path = $el->getFullPath();
             }
         }
     }
     // object <=> user dependencies
     $userObjects = Object_Service::getObjectsReferencingUser($user->getId());
     $userObjectData = array();
     $currentUser = Zend_Registry::get("pimcore_user");
     foreach ($userObjects as $o) {
         $hasHidden = false;
         if ($o->isAllowed("list")) {
             $userObjectData[] = array("path" => $o->getFullPath(), "id" => $o->getId(), "subtype" => $o->getClass()->getName());
         } else {
             $hasHidden = true;
         }
     }
     // get available permissions
     $availableUserPermissionsList = new User_Permission_Definition_List();
     $availableUserPermissions = $availableUserPermissionsList->load();
     // get available roles
     $roles = array();
     $list = new User_Role_List();
     $list->setCondition("`type` = ?", array("role"));
     $list->load();
     $roles = array();
     if (is_array($list->getItems())) {
         foreach ($list->getItems() as $role) {
             $roles[] = array($role->getId(), $role->getName());
         }
     }
     $user->setPassword(null);
     $conf = Pimcore_Config::getSystemConfig();
     $this->_helper->json(array("success" => true, "wsenabled" => $conf->webservice->enabled, "user" => $user, "roles" => $roles, "permissions" => $user->generatePermissionList(), "availablePermissions" => $availableUserPermissions, "objectDependencies" => array("hasHidden" => $hasHidden, "dependencies" => $userObjectData)));
 }