|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
package info.bukova.isspst;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import info.bukova.isspst.data.Permission;
|
|
|
|
|
import info.bukova.isspst.data.Role;
|
|
|
|
|
import info.bukova.isspst.data.User;
|
|
|
|
@ -44,6 +46,7 @@ public class AppInitListener implements ServletContextListener {
|
|
|
|
|
checkRoles();
|
|
|
|
|
checkUsers();
|
|
|
|
|
checkPermissions();
|
|
|
|
|
checkAllAdminRights();
|
|
|
|
|
userService.removeAccess();
|
|
|
|
|
|
|
|
|
|
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() {
|
|
|
|
|
for (Module m : Constants.MODULES) {
|
|
|
|
|
Report rep = new Report();
|
|
|
|
|