add some special permissions (wip)
This commit is contained in:
+1
-1
@@ -172,7 +172,7 @@ public class ReadReportingServiceImpl implements ReadReportingService {
|
||||
+ " left join m_permission p on p.id = rp.permission_id"
|
||||
+ " where ur.appuser_id = "
|
||||
+ context.authenticatedUser().getId()
|
||||
+ " and (r.name = 'Super User' or r.name = 'Read Only') or p.code = concat('CAN_RUN_', r.report_name))"
|
||||
+ " and (p.code in ('ALL_FUNCTIONS', 'ALL_FUNCTIONS_READ') or p.code = concat('CAN_RUN_', r.report_name))) "
|
||||
+ " order by r.report_name, rp.parameter_id";
|
||||
} else {
|
||||
sql = getSQLtoRun(name, type, queryParams);
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ public class ReadWriteNonCoreDataServiceImpl implements
|
||||
+ " left join m_permission p on p.id = rp.permission_id"
|
||||
+ " where ur.appuser_id = "
|
||||
+ context.authenticatedUser().getId()
|
||||
+ " and (r.name = 'Super User' or r.name = 'Read Only') or p.code = concat('CAN_READ_', t.`name`, '_x', d.`name`)) "
|
||||
+ " and (p.code in ('ALL_FUNCTIONS', 'ALL_FUNCTIONS_READ') or p.code = concat('CAN_READ_', t.`name`, '_x', d.`name`))) "
|
||||
+ andClause + " order by d.`name`";
|
||||
|
||||
sql = genericDataService.wrapSQL(sql);
|
||||
|
||||
@@ -262,40 +262,29 @@ public class AppUser extends AbstractAuditableCustom<AppUser, Long> implements
|
||||
|
||||
public boolean hasNotPermissionForReport(String reportName) {
|
||||
|
||||
for (Role role : this.roles) {
|
||||
if (role.getName().equalsIgnoreCase("Super User"))
|
||||
return false;
|
||||
if (role.getName().equalsIgnoreCase("Read Only"))
|
||||
return false;
|
||||
}
|
||||
if (hasNotPermissionForAnyOf("ALL_FUNCTIONS", "ALL_FUNCTIONS_READ", "CAN_RUN_" + reportName))
|
||||
return true;
|
||||
|
||||
if (hasPermissionTo("CAN_RUN_" + reportName))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasNotPermissionForSet(String type, String set,
|
||||
String accessType) {
|
||||
|
||||
for (Role role : this.roles) {
|
||||
String matchPermission = "CAN_" + accessType + "_" + type + "_x" + set;
|
||||
|
||||
if (role.getName().equalsIgnoreCase("Super User"))
|
||||
return false;
|
||||
if (accessType.equalsIgnoreCase("READ")) {
|
||||
|
||||
if (accessType.equalsIgnoreCase("READ")) {
|
||||
|
||||
if (role.getName().equalsIgnoreCase("Read Only"))
|
||||
return false;
|
||||
|
||||
}
|
||||
if (hasNotPermissionForAnyOf("ALL_FUNCTIONS", "ALL_FUNCTIONS_READ", matchPermission))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
String matchPermission = "CAN_" + accessType + "_" + type + "_x" + set;
|
||||
if (hasPermissionTo(matchPermission))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
if (hasNotPermissionForAnyOf("ALL_FUNCTIONS", matchPermission))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasNotPermissionForAnyOf(final String... permissionCodes) {
|
||||
|
||||
Reference in New Issue
Block a user