Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,17 @@ private static void loadConfig() {
loadConfig.put("adminOnlyProjectAddAccess", AbstractSecurityUtils.adminOnlyProjectAddAccess());
loadConfig.put("adminOnlyProjectSetPublic", AbstractSecurityUtils.adminOnlyProjectSetPublic());
loadConfig.put("adminOnlyProjectSetDiscoverable", AbstractSecurityUtils.adminOnlyProjectSetDiscoverable());
loadConfig.put("adminOnlyWorkspaceAdd", AbstractSecurityUtils.adminOnlyWorkspaceAdd());
loadConfig.put("adminOnlyWorkspaceDelete", AbstractSecurityUtils.adminOnlyWorkspaceDelete());
loadConfig.put("adminOnlyWorkspaceAddAccess", AbstractSecurityUtils.adminOnlyWorkspaceAddAccess());
loadConfig.put("adminOnlyWorkspaceSetPublic", AbstractSecurityUtils.adminOnlyWorkspaceSetPublic());
loadConfig.put("adminOnlyWorkspaceSetDiscoverable",
AbstractSecurityUtils.adminOnlyWorkspaceSetDiscoverable());
loadConfig.put("adminOnlySkillAdd", AbstractSecurityUtils.adminOnlySkillAdd());
loadConfig.put("adminOnlySkillDelete", AbstractSecurityUtils.adminOnlySkillDelete());
loadConfig.put("adminOnlySkillAddAccess", AbstractSecurityUtils.adminOnlySkillAddAccess());
loadConfig.put("adminOnlySkillSetPublic", AbstractSecurityUtils.adminOnlySkillSetPublic());
loadConfig.put("adminOnlySkillSetDiscoverable", AbstractSecurityUtils.adminOnlySkillSetDiscoverable());
// admin only for engine actions
loadConfig.put("adminOnlyDbAdd", AbstractSecurityUtils.adminOnlyDatabaseAdd());
loadConfig.put("adminOnlyDbDelete", AbstractSecurityUtils.adminOnlyDatabaseDelete());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ public Response removeInsightUserPermissions(@Context HttpServletRequest request
String projectId = WebUtility.inputSanitizer(form.getFirst("projectId"));
String insightId = WebUtility.inputSanitizer(form.getFirst("insightId"));

if (AbstractSecurityUtils.adminOnlyProjectAddAccess() && !SecurityAdminUtils.userIsAdmin(user)) {
if (AbstractSecurityUtils.adminOnlyInsightAddAccess() && !SecurityAdminUtils.userIsAdmin(user)) {
classLogger.warn("User is trying to remove users from having access to insight {} but is not an admin",
insightId);
Map<String, String> errorMap = new HashMap<String, String>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public Response addProjectUserPermission(@Context HttpServletRequest request, Mu
String permission = WebUtility.inputSanitizer(form.getFirst("permission"));
String endDate = WebUtility.inputSanitizer(form.getFirst("endDate"));

if (AbstractSecurityUtils.adminOnlyProjectAddAccess() && !SecurityAdminUtils.userIsAdmin(user)) {
if (AbstractSecurityUtils.adminOnlyProjectAddAccess(projectId) && !SecurityAdminUtils.userIsAdmin(user)) {
classLogger.warn("User is trying to add a user for project {} but is not an admin", projectId);
Map<String, String> errorMap = new HashMap<String, String>();
errorMap.put(Constants.ERROR_MESSAGE, "This functionality is limited to only admins");
Expand Down Expand Up @@ -469,7 +469,7 @@ public Response propagateProjectDependencyPermission(@Context HttpServletRequest

// Determine if admin right are required to add users and, if so, if requester
// has those rights.
if (AbstractSecurityUtils.adminOnlyProjectAddAccess() && !SecurityAdminUtils.userIsAdmin(requester)) {
if (AbstractSecurityUtils.adminOnlyProjectAddAccess(projectId) && !SecurityAdminUtils.userIsAdmin(requester)) {
classLogger.warn("User is trying to add a user for project {} but is not an admin", projectId);
Map<String, String> errorMap = new HashMap<String, String>();
errorMap.put(Constants.ERROR_MESSAGE, "This functionality is limited to only admins");
Expand Down Expand Up @@ -518,7 +518,7 @@ public Response propagateProjectDependencyPermissions(@Context HttpServletReques

// Determine if admin right are required to add users and, if so, if requester
// has those rights.
if (AbstractSecurityUtils.adminOnlyProjectAddAccess() && !SecurityAdminUtils.userIsAdmin(requester)) {
if (AbstractSecurityUtils.adminOnlyProjectAddAccess(projectId) && !SecurityAdminUtils.userIsAdmin(requester)) {
classLogger.warn("User is trying to add a user for project {} but is not an admin", projectId);
Map<String, String> errorMap = new HashMap<String, String>();
errorMap.put(Constants.ERROR_MESSAGE, "This functionality is limited to only admins");
Expand Down Expand Up @@ -606,7 +606,7 @@ public Response editProjectUserPermission(@Context HttpServletRequest request,
String newPermission = WebUtility.inputSanitizer(form.getFirst("permission"));
String endDate = WebUtility.inputSanitizer(form.getFirst("endDate"));

if (AbstractSecurityUtils.adminOnlyProjectAddAccess() && !SecurityAdminUtils.userIsAdmin(user)) {
if (AbstractSecurityUtils.adminOnlyProjectAddAccess(projectId) && !SecurityAdminUtils.userIsAdmin(user)) {
classLogger.warn("User is trying to edit user {} permissions for project {} but is not an admin",
existingUserId, projectId);
Map<String, String> errorMap = new HashMap<String, String>();
Expand Down Expand Up @@ -667,7 +667,7 @@ public Response editProjectUserPermissions(@Context HttpServletRequest request,
String projectId = WebUtility.inputSanitizer(form.getFirst("projectId"));
String endDate = WebUtility.inputSanitizer(form.getFirst("endDate"));

if (AbstractSecurityUtils.adminOnlyProjectAddAccess() && !SecurityAdminUtils.userIsAdmin(user)) {
if (AbstractSecurityUtils.adminOnlyProjectAddAccess(projectId) && !SecurityAdminUtils.userIsAdmin(user)) {
classLogger.warn("User is trying to edit user permissions for project {} but is not an admin", projectId);
Map<String, String> errorMap = new HashMap<String, String>();
errorMap.put(Constants.ERROR_MESSAGE, "This functionality is limited to only admins");
Expand Down Expand Up @@ -726,7 +726,7 @@ public Response removeProjectUserPermission(@Context HttpServletRequest request,
String existingUserId = WebUtility.inputSQLSanitizer(form.getFirst("id"));
String projectId = WebUtility.inputSanitizer(form.getFirst("projectId"));

if (AbstractSecurityUtils.adminOnlyProjectAddAccess() && !SecurityAdminUtils.userIsAdmin(user)) {
if (AbstractSecurityUtils.adminOnlyProjectAddAccess(projectId) && !SecurityAdminUtils.userIsAdmin(user)) {
classLogger.warn("User is trying to remove user {} from having access to project {} but is not an admin",
existingUserId, projectId);
Map<String, String> errorMap = new HashMap<String, String>();
Expand Down Expand Up @@ -785,7 +785,7 @@ public Response setProjectGlobal(@Context HttpServletRequest request, Multivalue
boolean isPublic = Boolean.parseBoolean(form.getFirst("public"));
String logPublic = isPublic ? " public " : " private";

if (AbstractSecurityUtils.adminOnlyProjectSetPublic() && !SecurityAdminUtils.userIsAdmin(user)) {
if (AbstractSecurityUtils.adminOnlyProjectSetPublic(projectId) && !SecurityAdminUtils.userIsAdmin(user)) {
classLogger.warn("User is trying to set the project {}{} but is not an admin", projectId, logPublic);
Map<String, String> errorMap = new HashMap<String, String>();
errorMap.put(Constants.ERROR_MESSAGE, "This functionality is limited to only admins");
Expand Down Expand Up @@ -843,7 +843,7 @@ public Response setProjectDiscoverable(@Context HttpServletRequest request, Mult
boolean isDiscoverable = Boolean.parseBoolean(form.getFirst("discoverable"));
String logDiscoverable = isDiscoverable ? " discoverable " : " not discoverable";

if (AbstractSecurityUtils.adminOnlyProjectSetDiscoverable() && !SecurityAdminUtils.userIsAdmin(user)) {
if (AbstractSecurityUtils.adminOnlyProjectSetDiscoverable(projectId) && !SecurityAdminUtils.userIsAdmin(user)) {
classLogger.warn("User is trying to set the project {}{} but is not an admin", projectId, logDiscoverable);
Map<String, String> errorMap = new HashMap<String, String>();
errorMap.put(Constants.ERROR_MESSAGE, "This functionality is limited to only admins");
Expand Down Expand Up @@ -1061,7 +1061,7 @@ public Response approveProjectUserAccessRequest(@Context HttpServletRequest requ
String projectId = WebUtility.inputSanitizer(form.getFirst("projectId"));
String endDate = WebUtility.inputSanitizer(form.getFirst("endDate"));

if (AbstractSecurityUtils.adminOnlyProjectAddAccess() && !SecurityAdminUtils.userIsAdmin(user)) {
if (AbstractSecurityUtils.adminOnlyProjectAddAccess(projectId) && !SecurityAdminUtils.userIsAdmin(user)) {
classLogger.warn("User is trying to approve user access to project {} but is not an admin", projectId);
Map<String, String> errorMap = new HashMap<String, String>();
errorMap.put(Constants.ERROR_MESSAGE, "This functionality is limited to only admins");
Expand Down Expand Up @@ -1119,7 +1119,7 @@ public Response denyProjectUserAccessRequest(@Context HttpServletRequest request

String projectId = WebUtility.inputSanitizer(form.getFirst("projectId"));

if (AbstractSecurityUtils.adminOnlyProjectAddAccess() && !SecurityAdminUtils.userIsAdmin(user)) {
if (AbstractSecurityUtils.adminOnlyProjectAddAccess(projectId) && !SecurityAdminUtils.userIsAdmin(user)) {
classLogger.warn("User is trying to deny user access to project {} but is not an admin", projectId);
Map<String, String> errorMap = new HashMap<String, String>();
errorMap.put(Constants.ERROR_MESSAGE, "This functionality is limited to only admins");
Expand Down Expand Up @@ -1170,7 +1170,7 @@ public Response addProjectUserPermissions(@Context HttpServletRequest request,

String projectId = WebUtility.inputSanitizer(form.getFirst("projectId"));
String endDate = WebUtility.inputSanitizer(form.getFirst("endDate"));
if (AbstractSecurityUtils.adminOnlyProjectAddAccess() && !SecurityAdminUtils.userIsAdmin(user)) {
if (AbstractSecurityUtils.adminOnlyProjectAddAccess(projectId) && !SecurityAdminUtils.userIsAdmin(user)) {
classLogger.warn("User is trying to add user permissions to project {} but is not an admin", projectId);
Map<String, String> errorMap = new HashMap<String, String>();
errorMap.put(Constants.ERROR_MESSAGE, "This functionality is limited to only admins");
Expand Down Expand Up @@ -1247,7 +1247,7 @@ public Response removeProjectUserPermissions(@Context HttpServletRequest request
List<String> ids = gson.fromJson(form.getFirst("ids"), List.class);
String projectId = WebUtility.inputSanitizer(form.getFirst("projectId"));

if (AbstractSecurityUtils.adminOnlyProjectAddAccess() && !SecurityAdminUtils.userIsAdmin(user)) {
if (AbstractSecurityUtils.adminOnlyProjectAddAccess(projectId) && !SecurityAdminUtils.userIsAdmin(user)) {
classLogger.warn("User is trying to remove users from having access to project {} but is not an admin",
projectId);
Map<String, String> errorMap = new HashMap<String, String>();
Expand Down
Loading