-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2135 from objectcomputing/feature-2134/add-catego…
…ries-to-permissions Swag at permissions changes
- Loading branch information
Showing
19 changed files
with
2,234 additions
and
23 deletions.
There are no files selected for viewing
52 changes: 34 additions & 18 deletions
52
server/src/main/java/com/objectcomputing/checkins/security/permissions/Permissions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,37 @@ | ||
package com.objectcomputing.checkins.security.permissions; | ||
|
||
public enum Permissions { | ||
CAN_VIEW_FEEDBACK_REQUEST, | ||
CAN_CREATE_FEEDBACK_REQUEST, | ||
CAN_DELETE_FEEDBACK_REQUEST, | ||
CAN_VIEW_FEEDBACK_ANSWER, | ||
CAN_DELETE_ORGANIZATION_MEMBERS, | ||
CAN_CREATE_ORGANIZATION_MEMBERS, | ||
CAN_VIEW_ROLE_PERMISSIONS, | ||
CAN_ASSIGN_ROLE_PERMISSIONS, | ||
CAN_VIEW_PERMISSIONS, | ||
CAN_VIEW_SKILLS_REPORT, | ||
CAN_VIEW_RETENTION_REPORT, | ||
CAN_VIEW_ANNIVERSARY_REPORT, | ||
CAN_VIEW_BIRTHDAY_REPORT, | ||
CAN_VIEW_PROFILE_REPORT, | ||
CAN_CREATE_CHECKINS, | ||
CAN_VIEW_CHECKINS, | ||
CAN_UPDATE_CHECKINS, | ||
} | ||
CAN_VIEW_FEEDBACK_REQUEST("View feedback requests", "Feedback"), | ||
CAN_CREATE_FEEDBACK_REQUEST("Create feedback requests", "Feedback"), | ||
CAN_DELETE_FEEDBACK_REQUEST("Delete feedback requests", "Feedback"), | ||
CAN_VIEW_FEEDBACK_ANSWER("View feedback answers", "Feedback"), | ||
CAN_DELETE_ORGANIZATION_MEMBERS("Delete organization members", "User Management"), | ||
CAN_CREATE_ORGANIZATION_MEMBERS("Create organization members", "User Management"), | ||
CAN_VIEW_ROLE_PERMISSIONS("View role permissions", "Security"), | ||
CAN_ASSIGN_ROLE_PERMISSIONS("Assign role permissions", "Security"), | ||
CAN_VIEW_PERMISSIONS("View all permissions", "Security"), | ||
CAN_VIEW_SKILLS_REPORT("View skills report", "Reporting"), | ||
CAN_VIEW_RETENTION_REPORT("View retention report", "Reporting"), | ||
CAN_VIEW_ANNIVERSARY_REPORT("View anniversary report", "Reporting"), | ||
CAN_VIEW_BIRTHDAY_REPORT("View birthday report", "Reporting"), | ||
CAN_VIEW_PROFILE_REPORT("View profile report", "Reporting"), | ||
CAN_CREATE_CHECKINS("Create check-ins", "Check-ins"), | ||
CAN_VIEW_CHECKINS("View check-ins", "Check-ins"), | ||
CAN_UPDATE_CHECKINS("Update check-ins", "Check-ins"); | ||
|
||
private final String description; | ||
private final String category; | ||
|
||
Permissions(String description, String category) { | ||
this.description = description; | ||
this.category = category; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public String getCategory() { | ||
return category; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { resolve } from "./api.js"; | ||
|
||
const memberRolesUrl = "/services/roles/members" | ||
|
||
export const getMemberRolesList = async (cookie) => { | ||
return resolve({ | ||
url: memberRolesUrl, | ||
responseType: "json", | ||
headers: { "X-CSRF-Header": cookie }, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { resolve } from "./api.js"; | ||
|
||
const permissionsListUrl = "/services/permissions" | ||
|
||
export const getPermissionsList = async (cookie) => { | ||
return resolve({ | ||
url: permissionsListUrl, | ||
responseType: "json", | ||
headers: { "X-CSRF-Header": cookie }, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { resolve } from "./api.js"; | ||
|
||
const rolePermissionsListUrl = "/services/roles/role-permissions"; | ||
|
||
export const getRolePermissionsList = async (cookie) => { | ||
return resolve({ | ||
url: rolePermissionsListUrl, | ||
responseType: "json", | ||
headers: { "X-CSRF-Header": cookie }, | ||
}); | ||
}; | ||
|
||
export const postRolePermission = async (roleData, cookie) => { | ||
return resolve({ | ||
method: "post", | ||
url: rolePermissionsListUrl, | ||
responseType: "json", | ||
data: roleData, | ||
headers: { "X-CSRF-Header": cookie }, | ||
}); | ||
}; | ||
|
||
export const deleteRolePermission = async (roleData, cookie) => { | ||
return resolve({ | ||
method: "delete", | ||
url: rolePermissionsListUrl, | ||
responseType: "json", | ||
data: roleData, | ||
headers: { "X-CSRF-Header": cookie }, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* Full check for whether an array actually exists or is empty, etc | ||
* @param arr - an array | ||
* @returns a boolean | ||
*/ | ||
|
||
export const isArrayPresent = (arr) => Array.isArray(arr) && arr.length; | ||
|
||
/** | ||
* If a parameter is found in an object within an array, return the array with just that object. | ||
* @param arr - an array | ||
* @param value - a value | ||
* @param key - an optional key with which to search | ||
* @returns an array | ||
*/ | ||
|
||
export function filterObjectByValOrKey(arr, value, key) { | ||
return arr.filter( | ||
key | ||
? (a) => a[key].indexOf(value) > -1 | ||
: (a) => Object.keys(a).some((k) => a[k] === value) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.edit-permissions-page { | ||
margin: 2rem; | ||
} | ||
|
||
.edit-permissions-list { | ||
margin: 1rem; | ||
} |
Oops, something went wrong.