示例#1
0
 /**
  * @param  User $user
  * @param  Object_Abstract $child
  * @param  Object_Abstract $parent
  * @param  boolean $expanded
  * @return
  */
 protected function getTreeNodePermissionConfig($user, $child, $parent, $expanded)
 {
     $userGroup = $user->getParent();
     if ($userGroup instanceof User) {
         $child->getPermissionsForUser($userGroup);
         $lock_list = $child->isAllowed("list");
         $lock_view = $child->isAllowed("view");
         $lock_save = $child->isAllowed("save");
         $lock_publish = $child->isAllowed("publish");
         $lock_unpublish = $child->isAllowed("unpublish");
         $lock_delete = $child->isAllowed("delete");
         $lock_rename = $child->isAllowed("rename");
         $lock_create = $child->isAllowed("create");
         $lock_permissions = $child->isAllowed("permissions");
         $lock_settings = $child->isAllowed("settings");
         $lock_versions = $child->isAllowed("versions");
         $lock_properties = $child->isAllowed("properties");
         $lock_properties = $child->isAllowed("properties");
     }
     if ($parent instanceof Object_Abstract) {
         $parent->getPermissionsForUser($user);
     }
     $objectPermissions = $child->getPermissionsForUser($user);
     $generallyAllowed = $user->isAllowed("objects");
     $parentId = (int) $child->getParentId();
     $parentAllowedList = true;
     if ($parent instanceof Object_Abstract) {
         $parentAllowedList = $parent->isAllowed("list") and $generallyAllowed;
     }
     $listAllowed = $child->isAllowed("list");
     $child->getPermissionsForUser($user);
     $tmpObject = array("_parent" => $parentId > 0 ? $parentId : null, "_id" => (int) $child->getId(), "text" => $child->getKey(), "type" => $child->getType(), "path" => $child->getFullPath(), "basePath" => $child->getPath(), "elementType" => "object", "permissionSet" => $objectPermissions->getId() > 0 and $objectPermissions->getCid() === $child->getId(), "list" => $listAllowed, "list_editable" => $parentAllowedList and $generallyAllowed and !$lock_list and !$user->isAdmin(), "view" => $child->isAllowed("view"), "view_editable" => $listAllowed and $generallyAllowed and !$lock_view and !$user->isAdmin(), "save" => $child->isAllowed("save"), "save_editable" => $listAllowed and $generallyAllowed and !$lock_save and !$user->isAdmin(), "publish" => $child->isAllowed("publish"), "publish_editable" => $listAllowed and $generallyAllowed and !$lock_publish and !$user->isAdmin(), "unpublish" => $child->isAllowed("unpublish"), "unpublish_editable" => $listAllowed and $generallyAllowed and !$lock_unpublish and !$user->isAdmin(), "delete" => $child->isAllowed("delete"), "delete_editable" => $listAllowed and $generallyAllowed and !$lock_delete and !$user->isAdmin(), "rename" => $child->isAllowed("rename"), "rename_editable" => $listAllowed and $generallyAllowed and !$lock_rename and !$user->isAdmin(), "create" => $child->isAllowed("create"), "create_editable" => $listAllowed and $generallyAllowed and !$lock_create and !$user->isAdmin(), "permissions" => $child->isAllowed("permissions"), "permissions_editable" => $listAllowed and $generallyAllowed and !$lock_permissions and !$user->isAdmin(), "settings" => $child->isAllowed("settings"), "settings_editable" => $listAllowed and $generallyAllowed and !$lock_settings and !$user->isAdmin(), "versions" => $child->isAllowed("versions"), "versions_editable" => $listAllowed and $generallyAllowed and !$lock_versions and !$user->isAdmin(), "properties" => $child->isAllowed("properties"), "properties_editable" => $listAllowed and $generallyAllowed and !$lock_properties and !$user->isAdmin());
     $tmpObject["expanded"] = $expanded;
     $tmpObject["_is_leaf"] = $child->hasNoChilds();
     $tmpObject["iconCls"] = "pimcore_icon_object";
     if ($child->getType() == "folder") {
         $tmpObject["iconCls"] = "pimcore_icon_folder";
         $tmpObject["qtipCfg"] = array("title" => "ID: " . $child->getId());
     } else {
         $tmpObject["className"] = $child->getClass()->getName();
         $tmpObject["qtipCfg"] = array("title" => "ID: " . $child->getId(), "text" => 'Type: ' . $child->getClass()->getName());
         if (!$child->isPublished()) {
             $tmpObject["cls"] = "pimcore_unpublished";
         }
         if ($child->getClass()->getIcon()) {
             unset($tmpObject["iconCls"]);
             $tmpObject["icon"] = $child->getClass()->getIcon();
         }
     }
     return $tmpObject;
 }