Skip to content
Draft
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
38 changes: 20 additions & 18 deletions src/prerna/auth/utils/SecurityEngineUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -665,9 +665,10 @@ public static void approveEngineUserAccessRequests(User user, String engineId, L
if (Utility.isNotificationDatabaseEnabled()) {
String engineType = String.valueOf(getEngineType(engineId)).toLowerCase();
for (int i = 0; i < requests.size(); i++) {
NotificationDbUtils.createNotification(user, requests.get(i).get("userid"),
requests.get(i).get("type"), engineId, NotificationConstants.Type.REQUEST_APPROVAL,
engineType, NotificationConstants.Priority.MEDIUM, null, requests.get(i).get("permission"));
NotificationDbUtils.createNotification(user, requests.get(i).get("userid"),
requests.get(i).get("type"), engineId, NotificationConstants.Type.REQUEST_APPROVAL,
engineType, NotificationConstants.Priority.MEDIUM, null, requests.get(i).get("permission"),
NotificationConstants.DisplaySurface.BELL);
// Adding email notification
EmailUtility.sendAccessRequestApprovalEmailNotification(user, requests.get(i).get("userid"),
engineId, requests.get(i).get("permission"), EmailUtility.RESOURCE_TYPE.ENGINE);
Expand Down Expand Up @@ -738,10 +739,11 @@ public static void denyEngineUserAccessRequests(User user, String engineId, List
List<Map<String, Object>> deniedUserDetails = getUserDetailsFromEngineAccessRequest(requestId);
String permission = AccessPermissionEnum
.getPermissionValueById((Integer) deniedUserDetails.get(i).get("permission"));
NotificationDbUtils.createNotification(user, (String) deniedUserDetails.get(i).get("userId"),
(String) deniedUserDetails.get(i).get("type"), engineId,
NotificationConstants.Type.REQUEST_DENIAL, engineType,
NotificationConstants.Priority.MEDIUM, null, permission);
NotificationDbUtils.createNotification(user, (String) deniedUserDetails.get(i).get("userId"),
(String) deniedUserDetails.get(i).get("type"), engineId,
NotificationConstants.Type.REQUEST_DENIAL, engineType,
NotificationConstants.Priority.MEDIUM, null, permission,
NotificationConstants.DisplaySurface.BELL);
}
}

Expand Down Expand Up @@ -1154,10 +1156,10 @@ public static void addEngineUserPermissions(User user, String engineId, List<Map
if (Utility.isNotificationDatabaseEnabled()) {
String engineType = String.valueOf(getEngineType(engineId)).toLowerCase();
for (int i = 0; i < permission.size(); i++) {
NotificationDbUtils.createNotification(user, (String) permission.get(i).get("userid"),
(String) permission.get(i).get("type"), engineId, NotificationConstants.Type.USER_ADDITION,
engineType, NotificationConstants.Priority.MEDIUM, null,
(String) permission.get(i).get("permission"));
NotificationDbUtils.createNotification(user, (String) permission.get(i).get("userid"),
(String) permission.get(i).get("type"), engineId, NotificationConstants.Type.USER_ADDITION,
engineType, NotificationConstants.Priority.MEDIUM, null,
(String) permission.get(i).get("permission"), NotificationConstants.DisplaySurface.BELL);
}
}

Expand Down Expand Up @@ -1271,9 +1273,9 @@ public static void editEngineUserPermission(User user, String existingUserId, St
if (Utility.isNotificationDatabaseEnabled()) {
String engineType = String.valueOf(getEngineType(engineId)).toLowerCase();
String existingPermission = AccessPermissionEnum.getPermissionValueById(existingUserPermission);
NotificationDbUtils.createNotification(user, existingUserId, existingUserType, engineId,
NotificationConstants.Type.PERMISSION_CHANGE, engineType, NotificationConstants.Priority.MEDIUM,
existingPermission, newPermission);
NotificationDbUtils.createNotification(user, existingUserId, existingUserType, engineId,
NotificationConstants.Type.PERMISSION_CHANGE, engineType, NotificationConstants.Priority.MEDIUM,
existingPermission, newPermission, NotificationConstants.DisplaySurface.BELL);
}
} catch (Exception e) {
classLogger.error("Failed to update engine user permission", e);
Expand Down Expand Up @@ -1400,10 +1402,10 @@ public static void editEngineUserPermissions(User user, String engineId, List<Ma

// Adding Notification
if (Utility.isNotificationDatabaseEnabled()) {
NotificationDbUtils.createNotification(user, newUserId, newUserType, engineId,
NotificationConstants.Type.PERMISSION_CHANGE, engineType,
NotificationConstants.Priority.MEDIUM, existingPermission,
(String) thisPermissionMap.get("permission"));
NotificationDbUtils.createNotification(user, newUserId, newUserType, engineId,
NotificationConstants.Type.PERMISSION_CHANGE, engineType,
NotificationConstants.Priority.MEDIUM, existingPermission,
(String) thisPermissionMap.get("permission"), NotificationConstants.DisplaySurface.BELL);
}
}
ps.executeBatch();
Expand Down
42 changes: 22 additions & 20 deletions src/prerna/auth/utils/SecurityProjectUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -1544,10 +1544,11 @@ public static void editProjectUserPermission(User user, String existingUserId, S
// Adding Notification
// Check notificationDb (conditional)
if (Utility.isNotificationDatabaseEnabled()) {
String existingPermission = AccessPermissionEnum.getPermissionValueById(existingUserPermission);
NotificationDbUtils.createNotification(user, existingUserId, existingUserType, projectId,
NotificationConstants.Type.PERMISSION_CHANGE, NotificationConstants.APP_CATALOG,
NotificationConstants.Priority.MEDIUM, existingPermission, newPermission);
String existingPermission = AccessPermissionEnum.getPermissionValueById(existingUserPermission);
NotificationDbUtils.createNotification(user, existingUserId, existingUserType, projectId,
NotificationConstants.Type.PERMISSION_CHANGE, NotificationConstants.APP_CATALOG,
NotificationConstants.Priority.MEDIUM, existingPermission, newPermission,
NotificationConstants.DisplaySurface.BELL);
}
} catch (Exception e) {
classLogger.error("Failed to update project user permission", e);
Expand Down Expand Up @@ -1644,10 +1645,10 @@ public static void editProjectUserPermissions(User user, String projectId, List<

// Adding Notification
if (Utility.isNotificationDatabaseEnabled()) {
NotificationDbUtils.createNotification(user, newUserId, newUserType, projectId,
NotificationConstants.Type.PERMISSION_CHANGE, NotificationConstants.APP_CATALOG,
NotificationConstants.Priority.MEDIUM, existingPermission,
requests.get(i).get("permission"));
NotificationDbUtils.createNotification(user, newUserId, newUserType, projectId,
NotificationConstants.Type.PERMISSION_CHANGE, NotificationConstants.APP_CATALOG,
NotificationConstants.Priority.MEDIUM, existingPermission,
requests.get(i).get("permission"), NotificationConstants.DisplaySurface.BELL);
}
}
ps.executeBatch();
Expand Down Expand Up @@ -4665,10 +4666,10 @@ public static void approveProjectUserAccessRequests(User user, String projectId,
// Adding Notification
if (Utility.isNotificationDatabaseEnabled()) {
for (int i = 0; i < requests.size(); i++) {
NotificationDbUtils.createNotification(user, requests.get(i).get("userid"),
requests.get(i).get("type"), projectId, NotificationConstants.Type.REQUEST_APPROVAL,
NotificationConstants.APP_CATALOG, NotificationConstants.Priority.MEDIUM, null,
requests.get(i).get("permission"));
NotificationDbUtils.createNotification(user, requests.get(i).get("userid"),
requests.get(i).get("type"), projectId, NotificationConstants.Type.REQUEST_APPROVAL,
NotificationConstants.APP_CATALOG, NotificationConstants.Priority.MEDIUM, null,
requests.get(i).get("permission"), NotificationConstants.DisplaySurface.BELL);
// Adding email notification
EmailUtility.sendAccessRequestApprovalEmailNotification(user, requests.get(i).get("userid"),
projectId, requests.get(i).get("permission"), EmailUtility.RESOURCE_TYPE.PROJECT);
Expand Down Expand Up @@ -4738,10 +4739,11 @@ public static void denyProjectUserAccessRequests(User user, String projectId, Li
List<Map<String, Object>> deniedUserDetails = getUserDetailsFromProjectAccessRequest(requestId);
String permission = AccessPermissionEnum
.getPermissionValueById((Integer) deniedUserDetails.get(i).get("permission"));
NotificationDbUtils.createNotification(user, (String) deniedUserDetails.get(i).get("userId"),
(String) deniedUserDetails.get(i).get("type"), projectId,
NotificationConstants.Type.REQUEST_DENIAL, NotificationConstants.APP_CATALOG,
NotificationConstants.Priority.MEDIUM, null, permission);
NotificationDbUtils.createNotification(user, (String) deniedUserDetails.get(i).get("userId"),
(String) deniedUserDetails.get(i).get("type"), projectId,
NotificationConstants.Type.REQUEST_DENIAL, NotificationConstants.APP_CATALOG,
NotificationConstants.Priority.MEDIUM, null, permission,
NotificationConstants.DisplaySurface.BELL);
}
}

Expand Down Expand Up @@ -4825,10 +4827,10 @@ public static void addProjectUserPermissions(User user, String projectId, List<M
// Adding Notification
if (Utility.isNotificationDatabaseEnabled()) {
for (int i = 0; i < permission.size(); i++) {
NotificationDbUtils.createNotification(user, permission.get(i).get("userid"),
permission.get(i).get("type"), projectId, NotificationConstants.Type.USER_ADDITION,
NotificationConstants.APP_CATALOG, NotificationConstants.Priority.MEDIUM, null,
permission.get(i).get("permission"));
NotificationDbUtils.createNotification(user, permission.get(i).get("userid"),
permission.get(i).get("type"), projectId, NotificationConstants.Type.USER_ADDITION,
NotificationConstants.APP_CATALOG, NotificationConstants.Priority.MEDIUM, null,
permission.get(i).get("permission"), NotificationConstants.DisplaySurface.BELL);
}
}

Expand Down
Loading
Loading