optimized privileges management
This commit is contained in:
@@ -8,7 +8,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = 'de.jottyfan.camporganizer'
|
group = 'de.jottyfan.camporganizer'
|
||||||
version = '1.0.0'
|
version = '1.0.1'
|
||||||
|
|
||||||
description = """CampOrganizer2"""
|
description = """CampOrganizer2"""
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
|
import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
|
||||||
import de.jottyfan.camporganizer.module.admin.model.CampBean;
|
import de.jottyfan.camporganizer.module.admin.model.CampBean;
|
||||||
@@ -54,6 +55,7 @@ public class AdminPrivilegesController extends CommonController {
|
|||||||
model.addAttribute("selected", role);
|
model.addAttribute("selected", role);
|
||||||
model.addAttribute("container", service.getPersonCampMappingByModule(EnumModule.valueOf(role)));
|
model.addAttribute("container", service.getPersonCampMappingByModule(EnumModule.valueOf(role)));
|
||||||
model.addAttribute("pagedest", "_admin_privileges_rolebased_" + role);
|
model.addAttribute("pagedest", "_admin_privileges_rolebased_" + role);
|
||||||
|
model.addAttribute("module", role);
|
||||||
return "/admin/privileges/rolebased";
|
return "/admin/privileges/rolebased";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,6 +72,7 @@ public class AdminPrivilegesController extends CommonController {
|
|||||||
model.addAttribute("selected", campname);
|
model.addAttribute("selected", campname);
|
||||||
model.addAttribute("container", service.getPersonModuleMappingByCamp(campid));
|
model.addAttribute("container", service.getPersonModuleMappingByCamp(campid));
|
||||||
model.addAttribute("pagedest", "_admin_privileges_campbased_" + campid);
|
model.addAttribute("pagedest", "_admin_privileges_campbased_" + campid);
|
||||||
|
model.addAttribute("fkCamp", campid);
|
||||||
return "/admin/privileges/campbased";
|
return "/admin/privileges/campbased";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,6 +89,7 @@ public class AdminPrivilegesController extends CommonController {
|
|||||||
model.addAttribute("selected", selected);
|
model.addAttribute("selected", selected);
|
||||||
model.addAttribute("container", service.getModuleCampMappingByPerson(userid));
|
model.addAttribute("container", service.getModuleCampMappingByPerson(userid));
|
||||||
model.addAttribute("pagedest", "_admin_privileges_userbased_" + userid);
|
model.addAttribute("pagedest", "_admin_privileges_userbased_" + userid);
|
||||||
|
model.addAttribute("fkProfile", userid);
|
||||||
return "/admin/privileges/userbased";
|
return "/admin/privileges/userbased";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,9 +100,12 @@ public class AdminPrivilegesController extends CommonController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/admin/privileges/add/{pagedest}")
|
@GetMapping("/admin/privileges/add/{pagedest}")
|
||||||
public String prepareAdd(Model model, @PathVariable("pagedest") String pagedest) {
|
public String prepareAdd(Model model, @PathVariable("pagedest") String pagedest,
|
||||||
|
@RequestParam(name = "fkCamp", required = false) Integer fkCamp,
|
||||||
|
@RequestParam(name = "fkProfile", required = false) Integer fkProfile,
|
||||||
|
@RequestParam(name = "module", required = false) String module) {
|
||||||
model.addAttribute("pagedest", pagedest);
|
model.addAttribute("pagedest", pagedest);
|
||||||
model.addAttribute("bean", new CampProfileBean());
|
model.addAttribute("bean", CampProfileBean.of(fkCamp, fkProfile, module));
|
||||||
model.addAttribute("profiles", service.getProfiles());
|
model.addAttribute("profiles", service.getProfiles());
|
||||||
model.addAttribute("camps", service.getAllCamps());
|
model.addAttribute("camps", service.getAllCamps());
|
||||||
model.addAttribute("modules", service.getAllModules());
|
model.addAttribute("modules", service.getAllModules());
|
||||||
|
|||||||
@@ -22,6 +22,14 @@ public class CampProfileBean implements Serializable {
|
|||||||
@NotBlank
|
@NotBlank
|
||||||
private String module;
|
private String module;
|
||||||
|
|
||||||
|
public static final CampProfileBean of(Integer fkCamp, Integer fkProfile, String module) {
|
||||||
|
CampProfileBean bean = new CampProfileBean();
|
||||||
|
bean.setFkCamp(fkCamp);
|
||||||
|
bean.setFkProfile(fkProfile);
|
||||||
|
bean.setModule(module);
|
||||||
|
return bean;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the pk
|
* @return the pk
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" style="text-align: center"><a th:href="@{/admin/privileges/add/{d}(d=${pagedest})}" class="btn btn-outline-primary">neue Berechtigung vergeben</a></td>
|
<td colspan="2" style="text-align: center"><a th:href="@{/admin/privileges/add/{d}?fkCamp={c}(d=${pagedest},c=${fkCamp})}" class="btn btn-outline-primary">neue Berechtigung vergeben</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" style="text-align: center"><a th:href="@{/admin/privileges/add/{d}(d=${pagedest})}" class="btn btn-outline-primary">neue Berechtigung vergeben</a></td>
|
<td colspan="2" style="text-align: center"><a th:href="@{/admin/privileges/add/{d}?module={m}(d=${pagedest},m=${module})}" class="btn btn-outline-primary">neue Berechtigung vergeben</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" style="text-align: center"><a th:href="@{/admin/privileges/add/{d}(d=${pagedest})}" class="btn btn-outline-primary">neue Berechtigung vergeben</a></td>
|
<td colspan="2" style="text-align: center"><a th:href="@{/admin/privileges/add/{d}?fkProfile={u}(d=${pagedest},u=${fkProfile})}" class="btn btn-outline-primary">neue Berechtigung vergeben</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user