/** * @throws ProjectIDMissingException * @throws ProjectSecurityAccessDeniedException */ public static function permission() { global $project_security, $user; if ($_GET['project_id']) { $project_id = $_GET['project_id']; $project = new Project($project_id); $project_permission_array = ProjectPermission::list_entries_by_project_id($project_id); if ($user->get_user_id() == $project->get_owner_id() or $project_security->is_access(2, false) == true or $project_security->is_access(4, false) == true or $project_security->is_access(7, false) == true) { $argument_array = array(); $argument_array[0] = "project_id"; $argument_array[1] = $_GET['project_id']; $list = new List_IO("ProjectPermission", "ajax.php?nav=project", "list_project_permissions", "count_project_permissions", $argument_array, "ProjectAjaxMyProjects"); $list->add_column("", "symbol", false, "16px"); $list->add_column(Language::get_message("ProjectGeneralListColumnUserGroup", "general"), "name", true, null); $list->add_column(Language::get_message("ProjectGeneralListColumnType", "general"), "type", true, null); $list->add_column(Language::get_message("ProjectGeneralListColumnFullName", "general"), "fullname", true, null); $list->add_column(Language::get_message("ProjectGeneralListColumnCreatedBy", "general"), "createdby", true, null); $list->add_column(Language::get_message("ProjectGeneralListColumnRE", "general"), "re", false, "25px"); $list->add_column(Language::get_message("ProjectGeneralListColumnSR", "general"), "sr", false, "25px"); $list->add_column(Language::get_message("ProjectGeneralListColumnWR", "general"), "wr", false, "25px"); $list->add_column(Language::get_message("ProjectGeneralListColumnSW", "general"), "sw", false, "25px"); $list->add_column(Language::get_message("ProjectGeneralListColumnRA", "general"), "ra", false, "25px"); $list->add_column(Language::get_message("ProjectGeneralListColumnDE", "general"), "de", false, "25px"); $list->add_column(Language::get_message("ProjectGeneralListColumnSP", "general"), "sp", false, "25px"); $list->add_column(Language::get_message("ProjectGeneralListColumnE", "general"), "e", false, "16px"); $list->add_column(Language::get_message("ProjectGeneralListColumnD", "general"), "d", false, "16px"); $template = new HTMLTemplate("project/admin/permission.html"); $add_user_paramquery = $_GET; $add_user_paramquery['run'] = "admin_permission_add_user"; $add_user_params = http_build_query($add_user_paramquery, '', '&'); $template->set_var("add_user_params", $add_user_params); $add_group_paramquery = $_GET; $add_group_paramquery['run'] = "admin_permission_add_group"; $add_group_params = http_build_query($add_group_paramquery, '', '&'); $template->set_var("add_group_params", $add_group_params); $add_ou_paramquery = $_GET; $add_ou_paramquery['run'] = "admin_permission_add_ou"; $add_ou_params = http_build_query($add_ou_paramquery, '', '&'); $template->set_var("add_ou_params", $add_ou_params); $template->set_var("list", $list->get_list()); $template->output(); } else { throw new ProjectSecurityAccessDeniedException(); } } else { throw new ProjectIDMissingException(); } }
/** * @see ProjectInterface::move_to_project() * @param integer $organisation_unit_id * @return bool * @throws ProjectMoveException * @throws ProjectMoveProjectExistsException * @throws ProjectMovePermissionException * @throws ProjectMoveFolderException * @throws ProjectSecurityAccessDeniedException */ public function move_to_project($project_id) { global $user, $transaction; if ($this->project_id and $this->project and is_numeric($project_id)) { $project_security = new ProjectSecurity($this->project_id); if ($project_security->is_access(3, false)) { if (self::exist_project_name(null, $project_id, $this->project->get_name()) == false) { $transaction_id = $transaction->begin(); $project_permission_array = ProjectPermission::list_entries_by_project_id($this->project_id); if (is_array($project_permission_array) and count($project_permission_array) >= 1) { foreach ($project_permission_array as $key => $value) { try { $project_permission = ProjectPermission::get_instance($value); $project_permission->delete(); } catch (ProjectPermissionException $e) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } throw new ProjectMovePermissionException(); } } } if ($this->project->set_toid_organ_unit(null) == false) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } throw new ProjectMoveException(); } if ($this->project->set_toid_project($project_id) == false) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } throw new ProjectMoveException(); } $folder_id = ProjectFolder::get_folder_by_project_id($this->project_id); $folder = new Folder($folder_id); $destination_id = ProjectFolder::get_folder_by_project_id($project_id); if ($folder->move_folder($destination_id, false) == false) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } throw new ProjectMoveFolderException(); } if ($transaction_id != null) { $transaction->commit($transaction_id); } return true; } else { throw new ProjectMoveProjectExistsException(); } } else { throw new ProjectSecurityAccessDeniedException(); } } else { throw new ProjectMoveException(); } }
/** * @param string $json_argument_array * @return integer * @throws ProjectSecurityAccessDeniedException * @throws ProjectIDMissingException */ public static function count_project_permissions($json_argument_array) { global $user, $project_security; $argument_array = json_decode($json_argument_array); $project_id = $argument_array[1]; if (is_numeric($project_id)) { $project = new Project($project_id); $project_permission_array = ProjectPermission::list_entries_by_project_id($project_id); if ($user->get_user_id() == $project->get_owner_id() or $project_security->is_access(2, false) == true or $project_security->is_access(4, false) == true or $project_security->is_access(7, false) == true) { return Project_Wrapper::count_project_permissions($project_id); } else { throw new ProjectSecurityAccessDeniedException(); } } else { throw new ProjectIDMissingException(); } }
/** * @see ProjectSecurityInterface::list_involved_users() * @return array */ public function list_involved_users() { if ($this->project_id) { $return_array = array(); $project_permission_array = ProjectPermission::list_entries_by_project_id($this->project_id); if (is_array($project_permission_array) and count($project_permission_array) >= 1) { foreach ($project_permission_array as $key => $value) { $project_permission = ProjectPermission::get_instance($value); if (($user_id = $project_permission->get_user_id()) != null) { $permission_array = $project_permission->get_permission_array(); if ($permission_array['write'] == true) { array_push($return_array, $user_id); } } } if (is_array($return_array) and count($return_array) >= 1) { return $return_array; } else { return null; } } else { return null; } } else { return null; } }