|
|
@ -1,5 +1,7 @@
|
|
|
|
package info.bukova.isspst;
|
|
|
|
package info.bukova.isspst;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
import info.bukova.isspst.data.Permission;
|
|
|
|
import info.bukova.isspst.data.Permission;
|
|
|
|
import info.bukova.isspst.data.Role;
|
|
|
|
import info.bukova.isspst.data.Role;
|
|
|
|
import info.bukova.isspst.data.User;
|
|
|
|
import info.bukova.isspst.data.User;
|
|
|
@ -44,6 +46,7 @@ public class AppInitListener implements ServletContextListener {
|
|
|
|
checkRoles();
|
|
|
|
checkRoles();
|
|
|
|
checkUsers();
|
|
|
|
checkUsers();
|
|
|
|
checkPermissions();
|
|
|
|
checkPermissions();
|
|
|
|
|
|
|
|
checkAllAdminRights();
|
|
|
|
userService.removeAccess();
|
|
|
|
userService.removeAccess();
|
|
|
|
|
|
|
|
|
|
|
|
loadModuleReports();
|
|
|
|
loadModuleReports();
|
|
|
@ -97,6 +100,23 @@ public class AppInitListener implements ServletContextListener {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void checkAllAdminRights()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Role adminRole = roleService.getRoleByAuthority(Constants.ROLE_ADMIN);
|
|
|
|
|
|
|
|
List<Permission> permissionList = adminRole.getPermissions();
|
|
|
|
|
|
|
|
List<Permission> permissionListAvailable = permService.getAll();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Permission permitionAvailable : permissionListAvailable)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!permissionList.contains(permitionAvailable))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
adminRole.addPermission(permitionAvailable);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
roleService.update(adminRole);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void loadModuleReports() {
|
|
|
|
private void loadModuleReports() {
|
|
|
|
for (Module m : Constants.MODULES) {
|
|
|
|
for (Module m : Constants.MODULES) {
|
|
|
|
Report rep = new Report();
|
|
|
|
Report rep = new Report();
|
|
|
|