This commit is contained in:
Jottyfan 2023-05-06 17:44:14 +02:00
parent 4d604974e2
commit d1ee923f0a
17 changed files with 990 additions and 141 deletions

View File

@ -0,0 +1,122 @@
package de.jottyfan.camporganizer.module.admin;
import java.util.List;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
import de.jottyfan.camporganizer.module.camplist.CommonController;
/**
*
* @author jotty
*
*/
@Controller
public class AdminPrivilegesController extends CommonController {
@Autowired
private AdminPrivilegesService service;
@GetMapping("/admin/privileges/userbased")
public String getUserbased(Model model) {
model.addAttribute("list", service.getProfiles());
return "/admin/privileges/userbased";
}
@GetMapping("/admin/privileges/rolebased")
public String getRolebased(Model model) {
model.addAttribute("list", service.getAllModules());
return "/admin/privileges/rolebased";
}
@GetMapping("/admin/privileges/campbased")
public String getCampbased(Model model) {
model.addAttribute("list", service.getAllCamps());
return "/admin/privileges/campbased";
}
@GetMapping("/admin/privileges/rolebased/{role}")
public String getRolebased(@PathVariable String role, Model model) {
model.addAttribute("list", service.getAllModules());
model.addAttribute("selected", role);
model.addAttribute("container", service.getPersonCampMappingByModule(EnumModule.valueOf(role)));
model.addAttribute("pagedest", "_admin_privileges_rolebased_" + role);
return "/admin/privileges/rolebased";
}
@GetMapping("/admin/privileges/campbased/{campid}")
public String getCampbased(@PathVariable Integer campid, Model model) {
List<CampBean> list = service.getAllCamps();
model.addAttribute("list", list);
String campname = "?";
for (CampBean p : list) {
if (p.getPk().equals(campid)) {
campname = p.getFullname();
}
}
model.addAttribute("selected", campname);
model.addAttribute("container", service.getPersonModuleMappingByCamp(campid));
model.addAttribute("pagedest", "_admin_privileges_campbased_" + campid);
return "/admin/privileges/campbased";
}
@GetMapping("/admin/privileges/userbased/{userid}")
public String getUserbased(@PathVariable Integer userid, Model model) {
List<ProfileBean> list = service.getProfiles();
model.addAttribute("list", list);
String selected = "?";
for (ProfileBean p : list) {
if (p.getPk().equals(userid)) {
selected = p.getFullname();
}
}
model.addAttribute("selected", selected);
model.addAttribute("container", service.getModuleCampMappingByPerson(userid));
model.addAttribute("pagedest", "_admin_privileges_userbased_" + userid);
return "/admin/privileges/userbased";
}
@GetMapping("/admin/privileges/delete/{id}/{pagedest}")
public String deleteFromCampProfile(@PathVariable Integer id, @PathVariable String pagedest) {
service.deleteFromCampProfile(id);
return "redirect:" + pagedest.replace("_", "/");
}
@GetMapping("/admin/privileges/add/{pagedest}")
public String prepareAdd(Model model, @PathVariable String pagedest) {
model.addAttribute("pagedest", pagedest);
model.addAttribute("bean", new CampProfileBean());
model.addAttribute("profiles", service.getProfiles());
model.addAttribute("camps", service.getAllCamps());
model.addAttribute("modules", service.getAllModules());
return "/admin/privileges/add";
}
@PostMapping("/admin/privileges/insert/{pagedest}")
public String insertCampProfile(@Valid @ModelAttribute("bean") CampProfileBean bean, final BindingResult bindingResult, @PathVariable String pagedest, Model model) {
if (bindingResult.hasErrors()) {
model.addAttribute("pagedest", pagedest);
model.addAttribute("profiles", service.getProfiles());
model.addAttribute("camps", service.getAllCamps());
model.addAttribute("modules", service.getAllModules());
return "/admin/privileges/add";
}
service.insertIntoCampProfile(bean);
return "redirect:" + pagedest.replace("_", "/");
}
@GetMapping("/admin/privileges/abortinsert/{pagedest}")
public String abortInsert(@PathVariable String pagedest) {
return "redirect:" + pagedest.replace("_", "/");
}
}

View File

@ -0,0 +1,96 @@
package de.jottyfan.camporganizer.module.admin;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
/**
*
* @author jotty
*
*/
@Service
public class AdminPrivilegesService {
@Autowired
private AdminRepository adminRepository;
/**
* get all camp beans from the database
*
* @return all camp beans; an empty list at least
*/
public List<CampBean> getAllCamps() {
return adminRepository.getAllCamps();
}
/**
* get all profiles from the db
*
* @return the profiles
*/
public List<ProfileBean> getProfiles() {
return adminRepository.getProfiles();
}
/**
* get all roles
*
* @return all roles
*/
public List<String> getAllModules() {
return adminRepository.getAllModules();
}
/**
* get the mapping that contains the form bean for a selected module
*
* @param module the module
* @return the container
*/
public PrivilegesContainerBean getPersonCampMappingByModule(EnumModule module) {
return adminRepository.getPersonCampMappingByModule(module);
}
/**
* get the mapping that contains the form bean for a selected camp
*
* @param camp the camp ID
* @return the container
*/
public PrivilegesContainerBean getPersonModuleMappingByCamp(Integer camp) {
return adminRepository.getPersonModuleMappingByCamp(camp);
}
/**
* get the mapping that contains the form bean for a selected user
*
* @param user the user ID
* @return the container
*/
public PrivilegesContainerBean getModuleCampMappingByPerson(Integer user) {
return adminRepository.getModuleCampMappingByPerson(user);
}
/**
* delete from camp profile
*
* @param id the ID
*/
public void deleteFromCampProfile(Integer id) {
adminRepository.deleteFromCampProfile(id);
}
/**
* add the camp profile to the database
*
* @param bean the bean
*/
public void insertIntoCampProfile(CampProfileBean bean) {
EnumModule m = bean.getModule() == null ? null : EnumModule.valueOf(bean.getModule());
adminRepository.addToCampProfile(bean.getFkCamp(), bean.getFkProfile(), m);
}
}

View File

@ -1,6 +1,7 @@
package de.jottyfan.camporganizer.module.admin;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMP;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_CAMPPROFILE;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_DOCUMENT;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_DOCUMENTROLE;
import static de.jottyfan.camporganizer.db.jooq.Tables.T_LOCATION;
@ -31,6 +32,7 @@ import org.jooq.Record4;
import org.jooq.Record5;
import org.jooq.SelectConditionStep;
import org.jooq.SelectSeekStep1;
import org.jooq.SelectSeekStep2;
import org.jooq.SelectWhereStep;
import org.jooq.UpdateConditionStep;
import org.jooq.UpdateSetMoreStep;
@ -43,7 +45,9 @@ import org.springframework.transaction.annotation.Transactional;
import de.jottyfan.camporganizer.db.jooq.enums.EnumCamprole;
import de.jottyfan.camporganizer.db.jooq.enums.EnumDocument;
import de.jottyfan.camporganizer.db.jooq.enums.EnumFiletype;
import de.jottyfan.camporganizer.db.jooq.enums.EnumModule;
import de.jottyfan.camporganizer.db.jooq.tables.records.TCampRecord;
import de.jottyfan.camporganizer.db.jooq.tables.records.TCampprofileRecord;
import de.jottyfan.camporganizer.db.jooq.tables.records.TDocumentRecord;
import de.jottyfan.camporganizer.db.jooq.tables.records.TDocumentroleRecord;
import de.jottyfan.camporganizer.db.jooq.tables.records.TLocationRecord;
@ -482,4 +486,160 @@ public class AdminRepository {
}
return list;
}
/**
* get all modules
*
* @return all modules
*/
public List<String> getAllModules() {
List<String> list = new ArrayList<>();
for (EnumModule r : EnumModule.values()) {
list.add(r.getLiteral());
}
return list;
}
/**
* get the mapping that contains the form bean for a selected module
*
* @param module the module
* @return the container
*/
public PrivilegesContainerBean getPersonCampMappingByModule(EnumModule module) {
SelectSeekStep2<Record4<Integer, String, LocalDateTime, String>, LocalDateTime, Integer> sql = jooq
// @formatter:off
.select(T_CAMPPROFILE.PK,
T_CAMP.NAME,
T_CAMP.ARRIVE,
T_PROFILE.FORENAME.concat(" ").concat(T_PROFILE.SURNAME).as(T_PROFILE.USERNAME))
.from(T_CAMPPROFILE)
.leftJoin(T_CAMP).on(T_CAMP.PK.eq(T_CAMPPROFILE.FK_CAMP))
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_CAMPPROFILE.FK_PROFILE))
.where(T_CAMPPROFILE.MODULE.eq(module))
.orderBy(T_CAMP.ARRIVE, T_PROFILE.PK);
// @formatter:on
LOGGER.debug(sql.toString());
PrivilegesContainerBean pcb = new PrivilegesContainerBean();
for (Record4<Integer, String, LocalDateTime, String> r : sql.fetch()) {
Integer fkCampProfile = r.get(T_CAMPPROFILE.PK);
String username = r.get(T_PROFILE.USERNAME);
String campname = r.get(T_CAMP.NAME);
LocalDateTime ldt = r.get(T_CAMP.ARRIVE);
String year = ldt != null ? String.valueOf(ldt.getYear()) : "?";
campname = campname == null ? year : campname.concat(" ").concat(year);
if (pcb.get(username) == null) {
pcb.addKey(username);
}
pcb.add(username, IntKeyValueBean.of(fkCampProfile, campname));
}
return pcb;
}
/**
* get the mapping that contains the form bean for a selected user
*
* @param user the user ID
* @return the container
*/
public PrivilegesContainerBean getModuleCampMappingByPerson(Integer user) {
SelectSeekStep1<Record4<Integer, String, LocalDateTime, EnumModule>, LocalDateTime> sql = jooq
// @formatter:off
.select(T_CAMPPROFILE.PK,
T_CAMP.NAME,
T_CAMP.ARRIVE,
T_CAMPPROFILE.MODULE)
.from(T_CAMPPROFILE)
.leftJoin(T_CAMP).on(T_CAMP.PK.eq(T_CAMPPROFILE.FK_CAMP))
.where(T_CAMPPROFILE.FK_PROFILE.eq(user))
.orderBy(T_CAMP.ARRIVE);
// @formatter:on
LOGGER.debug(sql.toString());
PrivilegesContainerBean pcb = new PrivilegesContainerBean();
for (Record4<Integer, String, LocalDateTime, EnumModule> r : sql.fetch()) {
Integer fkCampProfile = r.get(T_CAMPPROFILE.PK);
EnumModule moduleEnum = r.get(T_CAMPPROFILE.MODULE);
String module = moduleEnum == null ? null : moduleEnum.getLiteral();
String campname = r.get(T_CAMP.NAME);
LocalDateTime ldt = r.get(T_CAMP.ARRIVE);
String year = ldt != null ? String.valueOf(ldt.getYear()) : "?";
campname = campname == null ? year : campname.concat(" ").concat(year);
if (pcb.get(module) == null) {
pcb.addKey(module);
}
pcb.add(module, IntKeyValueBean.of(fkCampProfile, campname));
}
return pcb;
}
/**
* get the mapping that contains the form bean for a selected camp
*
* @param camp the camp ID
* @return the container
*/
public PrivilegesContainerBean getPersonModuleMappingByCamp(Integer camp) {
SelectSeekStep2<Record4<Integer, String, String, EnumModule>, String, String> sql = jooq
// @formatter:off
.select(T_CAMPPROFILE.PK,
T_PROFILE.FORENAME,
T_PROFILE.SURNAME,
T_CAMPPROFILE.MODULE)
.from(T_CAMPPROFILE)
.leftJoin(T_CAMP).on(T_CAMP.PK.eq(T_CAMPPROFILE.FK_CAMP))
.leftJoin(T_PROFILE).on(T_PROFILE.PK.eq(T_CAMPPROFILE.FK_PROFILE))
.where(T_CAMPPROFILE.FK_CAMP.eq(camp))
.orderBy(T_PROFILE.SURNAME, T_PROFILE.FORENAME);
// @formatter:on
LOGGER.debug(sql.toString());
PrivilegesContainerBean pcb = new PrivilegesContainerBean();
for (Record4<Integer, String, String, EnumModule> r : sql.fetch()) {
Integer fkCampProfile = r.get(T_CAMPPROFILE.PK);
EnumModule moduleEnum = r.get(T_CAMPPROFILE.MODULE);
String forename = r.get(T_PROFILE.FORENAME);
String surname = r.get(T_PROFILE.SURNAME);
String person = new StringBuilder().append(forename).append(" ").append(surname).toString();
String module = moduleEnum == null ? null : moduleEnum.getLiteral();
if (pcb.get(person) == null) {
pcb.addKey(person);
}
pcb.add(person, IntKeyValueBean.of(fkCampProfile, module));
}
return pcb;
}
/**
* delete entry from camp profile
*
* @param id the pk
*/
public void deleteFromCampProfile(Integer id) {
DeleteConditionStep<TCampprofileRecord> sql = jooq.deleteFrom(T_CAMPPROFILE).where(T_CAMPPROFILE.PK.eq(id));
LOGGER.debug(sql.toString());
sql.execute();
}
/**
* add entry to database
*
* @param fkCamp the camp ID
* @param fkProfile the profile ID
* @param module the module
*/
public void addToCampProfile(Integer fkCamp, Integer fkProfile, EnumModule module) {
InsertReturningStep<TCampprofileRecord> sql = jooq
// @formatter:off
.insertInto(T_CAMPPROFILE,
T_CAMPPROFILE.FK_CAMP,
T_CAMPPROFILE.FK_PROFILE,
T_CAMPPROFILE.MODULE)
.values(fkCamp, fkProfile, module)
.onConflict(T_CAMPPROFILE.FK_CAMP,
T_CAMPPROFILE.FK_PROFILE,
T_CAMPPROFILE.MODULE)
.doNothing();
// @formatter:on
LOGGER.debug(sql.toString());
sql.execute();
}
}

View File

@ -3,6 +3,7 @@ package de.jottyfan.camporganizer.module.admin;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
@ -73,6 +74,10 @@ public class CampBean implements Serializable {
return bean;
}
public String getFullname() {
return new StringBuilder().append(name).append(" ").append(arrive == null ? "?" : arrive.format(DateTimeFormatter.ofPattern("yyyy"))).toString();
}
/**
* @return the pk
*/

View File

@ -0,0 +1,80 @@
package de.jottyfan.camporganizer.module.admin;
import java.io.Serializable;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
*
* @author jotty
*
*/
public class CampProfileBean implements Serializable {
private static final long serialVersionUID = 1L;
private Integer pk;
@NotNull
private Integer fkCamp;
@NotNull
private Integer fkProfile;
@NotBlank
private String module;
/**
* @return the pk
*/
public Integer getPk() {
return pk;
}
/**
* @param pk the pk to set
*/
public void setPk(Integer pk) {
this.pk = pk;
}
/**
* @return the fkCamp
*/
public Integer getFkCamp() {
return fkCamp;
}
/**
* @param fkCamp the fkCamp to set
*/
public void setFkCamp(Integer fkCamp) {
this.fkCamp = fkCamp;
}
/**
* @return the fkProfile
*/
public Integer getFkProfile() {
return fkProfile;
}
/**
* @param fkProfile the fkProfile to set
*/
public void setFkProfile(Integer fkProfile) {
this.fkProfile = fkProfile;
}
/**
* @return the module
*/
public String getModule() {
return module;
}
/**
* @param module the module to set
*/
public void setModule(String module) {
this.module = module;
}
}

View File

@ -0,0 +1,50 @@
package de.jottyfan.camporganizer.module.admin;
import java.io.Serializable;
/**
*
* @author jotty
*
*/
public class IntKeyValueBean implements Serializable {
private static final long serialVersionUID = 1L;
private Integer key;
private String value;
public static final IntKeyValueBean of(Integer key, String value) {
IntKeyValueBean bean = new IntKeyValueBean();
bean.setKey(key);
bean.setValue(value);
return bean;
}
/**
* @return the key
*/
public Integer getKey() {
return key;
}
/**
* @param key the key to set
*/
public void setKey(Integer key) {
this.key = key;
}
/**
* @return the value
*/
public String getValue() {
return value;
}
/**
* @param value the value to set
*/
public void setValue(String value) {
this.value = value;
}
}

View File

@ -0,0 +1,62 @@
package de.jottyfan.camporganizer.module.admin;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* @author jotty
*
*/
public class PrivilegesContainerBean implements Serializable {
private static final long serialVersionUID = 1L;
private Map<String, List<IntKeyValueBean>> map;
public PrivilegesContainerBean() {
map = new HashMap<>();
}
/**
* get the content of key
*
* @param key the key
* @return the value
*/
public List<IntKeyValueBean> get(String key) {
return map == null ? null : map.get(key);
}
/**
* add the value to the key
*
* @param key the key
* @param value the value
*/
public void add(String key, IntKeyValueBean value) {
if (get(key) != null) {
map.get(key).add(value);
} else {
throw new NullPointerException("key not found");
}
}
/**
* add the key to this map
*
* @param key
*/
public void addKey(String key) {
map.put(key, new ArrayList<>());
}
/**
* @return the map
*/
public Map<String, List<IntKeyValueBean>> getMap() {
return map;
}
}

View File

@ -27,6 +27,10 @@ public class ProfileBean implements Serializable {
return bean;
}
public String getFullname() {
return new StringBuilder().append(forename).append(" ").append(surname).toString();
}
/**
* @return the pk
*/

View File

@ -433,3 +433,7 @@ div {
box-shadow: 0px 0px 7px 4px #ddd;
border-radius: 40px;
}
.beforetext {
margin-right: 8px;
}

View File

@ -14,17 +14,17 @@
</thead>
<tbody>
<tr th:each="c : ${camps}">
<td><a th:href="@{/admin/camp/edit/{id}(id=${c.pk})}"><span th:text="${c.name}"></span></a></td>
<td><a th:href="@{/admin/camp/edit/{id}(id=${c.pk})}"><i class="fas fa-pen beforetext"></i><span th:text="${c.name}"></span></a></td>
<td><th:block th:each="l : ${locations}">
<span th:if="${l.pk == c.fkLocation}" th:text="${l.name}"></span>
</th:block></td>
<td><span th:text="${#temporals.format(c.arrive, 'dd.MM.')}"></span>&nbsp;-&nbsp;<span th:text="${#temporals.format(c.depart, 'dd.MM.yyyy')}"></span></td>
<td><a th:href="@{/document/{id}(id=${c.fkDocument})}"><i class="fas fa-download"></i></a></td>
<td><a th:href="@{/document/{id}(id=${c.fkDocument})}"><i class="fas fa-download beforetext"></i>anzeigen</a></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="6" style="text-align: center"><a th:href="@{/admin/camp/add}" class="btn btn-outline-primary">neue Freizeit anlegen</a></td>
<td colspan="4" style="text-align: center"><a th:href="@{/admin/camp/add}" class="btn btn-outline-primary">neue Freizeit anlegen</a></td>
</tr>
</tfoot>
</table>

View File

@ -10,12 +10,11 @@
<td>Dokumententyp</td>
<td>Zielgruppe</td>
<th>Inhalt</th>
<th>Dateityp</th>
</tr>
</thead>
<tbody>
<tr th:each="d : ${documents}">
<td><a th:href="@{/admin/document/edit/{id}(id=${d.pk})}"><span th:text="${d.name}"></span></a></td>
<td><a th:href="@{/admin/document/edit/{id}(id=${d.pk})}"><i class="fas fa-pen beforetext"></i><span th:text="${d.name}"></span></a></td>
<td><span th:if="${d.doctype.literal == 'location'}">Wegbeschreibung</span> <span th:if="${d.doctype.literal == 'camp'}">Bestätigung</span><span
th:if="${d.doctype.literal == 'camppass'}">Freizeitpass</span></td>
<td><th:block th:each="r : ${d.roles}">
@ -25,13 +24,12 @@
<span th:if="${r.literal == 'feeder'}" class="roleflag">Küche</span>
<span th:if="${r.literal == 'observer'}" class="roleflag">Mitarbeiterkind</span>
</th:block></td>
<td><a th:href="@{/document/{id}(id=${d.pk})}"><i class="fas fa-download"></i></a></td>
<td><span th:text="${d.filetype.literal}" th:if="${d.filetype}"></span></td>
<td><a th:href="@{/document/{id}(id=${d.pk})}"><i class="fas fa-download beforetext"></i><span th:text="${d.filetype.literal}" th:if="${d.filetype}"></span>&nbsp;anzeigen</a></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="6" style="text-align: center"><a th:href="@{/admin/document/add}" class="btn btn-outline-primary">neues Dokument anlegen</a></td>
<td colspan="4" style="text-align: center"><a th:href="@{/admin/document/add}" class="btn btn-outline-primary">neues Dokument anlegen</a></td>
</tr>
</tfoot>
</table>

View File

@ -13,14 +13,14 @@
</thead>
<tbody>
<tr th:each="l : ${locations}">
<td><a th:href="@{/admin/location/edit/{id}(id=${l.pk})}"><span th:text="${l.name}"></span></a></td>
<td th:text="${l.url}"></td>
<td><a th:href="@{/document/{id}(id=${l.fkDocument})}"><i class="fas fa-download"></i></a></td>
<td><a th:href="@{/admin/location/edit/{id}(id=${l.pk})}"><i class="fas fa-pen beforetext"></i><span th:text="${l.name}"></span></a></td>
<td><a th:href="${l.url}" target="_blank"><i class="fas fa-external-link-alt beforetext"></i><span th:text="${l.url}"></span></a></td>
<td><a th:href="@{/document/{id}(id=${l.fkDocument})}"><i class="fas fa-download beforetext"></i>anzeigen</a></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="6" style="text-align: center"><a th:href="@{/admin/location/add}" class="btn btn-outline-primary">neues Freizeitheim anlegen</a></td>
<td colspan="3" style="text-align: center"><a th:href="@{/admin/location/add}" class="btn btn-outline-primary">neues Freizeitheim anlegen</a></td>
</tr>
</tfoot>
</table>

View File

@ -0,0 +1,66 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" layout:decorate="~{template}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<body>
<th:block layout:fragment="content">
<div sec:authorize="hasRole('admin')">
<form th:action="@{/admin/privileges/insert/{d}(d=${pagedest})}" th:object="${bean}" method="post" enctype="multipart/form-data">
<div class="tablebox">
<div class="container">
<div class="row mb-2">
<div class="col-sm-12">
<div class="alert alter-danger" th:if="${error}" th:text="${error}"></div>
</div>
</div>
<div class="row mb-2">
<label for="inputPerson" class="col-sm-2 col-form-label">Person</label>
<div class="col-sm-10">
<span class="error" th:each="error : ${#fields.errors('fkProfile')}">[[${error}]]<br /></span> <select id="inputPerson" th:field="*{fkProfile}"
th:class="${'form-select ' + (#fields.hasErrors('fkProfile') ? 'inputerror' : '')}">
<option value="">--- bitte wählen ---</option>
<option th:each="l : ${profiles}" th:value="${l.pk}" th:text="${l.fullname}"></option>
</select>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#inputPerson").select2();
});
</script>
</div>
<div class="row mb-2">
<label for="inputCamp" class="col-sm-2 col-form-label">Freizeit</label>
<div class="col-sm-10">
<span class="error" th:each="error : ${#fields.errors('fkCamp')}">[[${error}]]<br /></span> <select id="inputCamp" th:field="*{fkCamp}"
th:class="${'form-select ' + (#fields.hasErrors('fkCamp') ? 'inputerror' : '')}">
<option value="">--- bitte wählen ---</option>
<option th:each="l : ${camps}" th:value="${l.pk}" th:text="${l.name}"></option>
</select>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#inputCamp").select2();
});
</script>
</div>
<div class="row mb-2">
<label for="inputModule" class="col-sm-2 col-form-label">Modul</label>
<div class="col-sm-10">
<span class="error" th:each="error : ${#fields.errors('module')}">[[${error}]]<br /></span> <select id="inputModule" th:field="*{module}"
th:class="${'form-select ' + (#fields.hasErrors('module') ? 'inputerror' : '')}">
<option value="">--- bitte wählen ---</option>
<option th:each="l : ${modules}" th:value="${l}" th:text="${l}"></option>
</select>
</div>
</div>
<div class="row mb-2">
<div class="col-sm-2"></div>
<div class="col-sm-10">
<input type="submit" class="btn btn-success" value="Ok" /> <a th:href="@{/admin/privileges/abortinsert/{d}(d=${pagedest})}" class="btn btn-outline-secondary">Abbrechen</a>
</div>
</div>
</div>
</div>
</form>
</div>
</th:block>
</body>
</html>

View File

@ -0,0 +1,70 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" layout:decorate="~{template}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
<title>Camp Organizer Privileges</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<th:block layout:fragment="content">
<div sec:authorize="hasRole('admin')">
<div class="tablebox">
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<span th:text="${selected}" th:if="${selected}"></span> <span th:unless="${selected}">-- bitte wählen --</span>
</button>
<ul class="dropdown-menu">
<li th:each="e : ${list}"><a class="dropdown-item" th:href="@{/admin/privileges/campbased/{r}(r=${e.pk})}"><span th:text="${e.fullname}"></span></a></li>
</ul>
</div>
<div class="card" th:if="${selected}">
<div class="card-header">
<h1 th:text="${selected}"></h1>
</div>
<div class="card-body">
<table id="table" class="table table-striped">
<thead>
<tr>
<th>Person</th>
<th>Modul</th>
</tr>
</thead>
<tbody>
<tr th:each="m : ${container.map}">
<td th:text="${m.key}"></td>
<td>
<div class="btn-toolbar" role="toolbar">
<div class="btn-group beforetext" role="group" th:each="v : ${m.value}" th:if="${m.value}">
<div class="dropdown">
<button class="btn btn-danger dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fas fa-trash-alt"></i>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" th:href="@{/admin/privileges/delete/{id}/{d}(id=${v.key}, d=${pagedest})}">endgültig löschen</a></li>
</ul>
</div>
<button type="button" class="btn btn-outline-secondary" th:text="${v.value}" disabled></button>
</div>
</div>
</td>
</tr>
</tbody>
<tfoot>
<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>
</tr>
</tfoot>
</table>
<script>
$(document).ready(function() {
$("#table").DataTable({
language : locale_de
});
});
</script>
</div>
</div>
</div>
</div>
</th:block>
</body>
</html>

View File

@ -0,0 +1,66 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" layout:decorate="~{template}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
<title>Camp Organizer Privileges</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<th:block layout:fragment="content">
<div sec:authorize="hasRole('admin')">
<div class="tablebox">
<div class="btn-group" role="group">
<a th:class="${e == selected ? 'btn btn-primary' : 'btn btn-outline-secondary'}" th:each="e : ${list}" th:href="@{/admin/privileges/rolebased/{r}(r=${e})}"> <span th:text="${e}"></span>
</a>
</div>
<div class="card" th:if="${selected}">
<div class="card-header">
<h1 th:text="${selected}"></h1>
</div>
<div class="card-body">
<table id="table" class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Freizeit</th>
</tr>
</thead>
<tbody>
<tr th:each="m : ${container.map}">
<td th:text="${m.key}"></td>
<td>
<div class="btn-toolbar" role="toolbar">
<div class="btn-group beforetext" role="group" th:each="v : ${m.value}" th:if="${m.value}">
<div class="dropdown">
<button class="btn btn-danger dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fas fa-trash-alt"></i>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" th:href="@{/admin/privileges/delete/{id}/{d}(id=${v.key}, d=${pagedest})}">endgültig löschen</a></li>
</ul>
</div>
<button type="button" class="btn btn-outline-secondary" th:text="${v.value}" disabled></button>
</div>
</div>
</td>
</tr>
</tbody>
<tfoot>
<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>
</tr>
</tfoot>
</table>
<script>
$(document).ready(function() {
$("#table").DataTable({
language : locale_de
});
});
</script>
</div>
</div>
</div>
</div>
</th:block>
</body>
</html>

View File

@ -0,0 +1,70 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" layout:decorate="~{template}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
<title>Camp Organizer Privileges</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<th:block layout:fragment="content">
<div sec:authorize="hasRole('admin')">
<div class="tablebox">
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<span th:text="${selected}" th:if="${selected}"></span> <span th:unless="${selected}">-- bitte wählen --</span>
</button>
<ul class="dropdown-menu">
<li th:each="e : ${list}"><a class="dropdown-item" th:href="@{/admin/privileges/userbased/{r}(r=${e.pk})}"><span th:text="${e.fullname}"></span></a></li>
</ul>
</div>
<div class="card" th:if="${selected}">
<div class="card-header">
<h1 th:text="${selected}"></h1>
</div>
<div class="card-body">
<table id="table" class="table table-striped">
<thead>
<tr>
<th>Modul</th>
<th>Freizeit</th>
</tr>
</thead>
<tbody>
<tr th:each="m : ${container.map}">
<td th:text="${m.key}"></td>
<td>
<div class="btn-toolbar" role="toolbar">
<div class="btn-group beforetext" role="group" th:each="v : ${m.value}" th:if="${m.value}">
<div class="dropdown">
<button class="btn btn-danger dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fas fa-trash-alt"></i>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" th:href="@{/admin/privileges/delete/{id}/{d}(id=${v.key}, d=${pagedest})}">endgültig löschen</a></li>
</ul>
</div>
<button type="button" class="btn btn-outline-secondary" th:text="${v.value}" disabled></button>
</div>
</div>
</td>
</tr>
</tbody>
<tfoot>
<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>
</tr>
</tfoot>
</table>
<script>
$(document).ready(function() {
$("#table").DataTable({
language : locale_de
});
});
</script>
</div>
</div>
</div>
</div>
</th:block>
</body>
</html>

View File

@ -25,7 +25,8 @@
<!-- remove? -->
<!-- <div class="container-fluid">
<!-- -->
<button class="navbar-toggler" style="margin-right: 40px" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false">
<button class="navbar-toggler" style="margin-right: 40px" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent" style="margin-right: 20px">
@ -35,10 +36,8 @@
<li class="nav-item"><a class="btn btn-icon-silent menufont" th:href="@{/allgemeines}">Allgemeines</a></li>
<li class="nav-item"><a class="btn btn-icon-silent menufont" th:href="@{/camplist}">Freizeiten</a></li>
<li class="nav-item"><a class="btn btn-icon-silent menufont" th:href="@{/verein}">Verein</a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle btn-icon-silent menufont" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Tagebuch
</a>
<li class="nav-item dropdown"><a class="nav-link dropdown-toggle btn-icon-silent menufont" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Tagebuch </a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item menufont" th:href="@{/reports/olfenostern2023}">Osterfreizeit 2023 in Olfen</a></li>
<li><hr class="dropdown-divider"></li>
@ -68,16 +67,13 @@
<li><a class="dropdown-item menufont" th:href="@{/reports/schweiz2014}">Schweiz 2014</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item menufont" th:href="@{/reports/history}">Über 30 Jahre Onkel Werner Freizeiten Ein Rückblick ...</a></li>
</ul>
</li>
</ul></li>
<li class="nav-item"><a class="btn btn-icon-silent menufont" th:href="@{/kontakt}">Kontakt</a></li>
</ul>
<ul class="navbar-nav mb-2 mb-lg-0" sec:authorize="hasRole('business')">
<li class="nav-item">
<div class="dropdown">
<a class="nav-link dropdown-toggle btn-icon-silent menufont" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Abrechnung
</a>
<a class="nav-link dropdown-toggle btn-icon-silent menufont" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">Abrechnung</a>
<ul class="dropdown-menu">
<li><a th:href="@{/business}" class="dropdown-item menufont">Freizeitübersicht</a></li>
<li><a th:href="@{/business/bookings}" class="dropdown-item menufont" sec:authorize="hasRole('business_booking')">Buchungsübersicht</a></li>
@ -89,9 +85,7 @@
<ul class="navbar-nav mb-2 mb-lg-0" sec:authorize="hasRole('registrator')">
<li class="nav-item">
<div class="dropdown">
<a class="nav-link dropdown-toggle btn-icon-silent menufont" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Bestätigung
</a>
<a class="nav-link dropdown-toggle btn-icon-silent menufont" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">Bestätigung</a>
<ul class="dropdown-menu">
<li><a th:href="@{/rss/registrator}" class="dropdown-item menufont"><i class="fas fa-rss"></i>&nbsp;RSS-Link</a></li>
<li><a th:href="@{/confirmation}" class="dropdown-item menufont">Anmeldungsübersicht</a></li>
@ -102,17 +96,20 @@
<ul class="navbar-nav mb-2 mb-lg-0" sec:authorize="hasRole('admin')">
<li class="nav-item">
<div class="dropdown">
<a class="nav-link dropdown-toggle btn-icon-silent menufont" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Admin
</a>
<a class="nav-link dropdown-toggle btn-icon-silent menufont" href="#" role="button" data-bs-toggle="dropdown" data-bs-auto-close='outside' aria-expanded="false">Admin</a>
<ul class="dropdown-menu">
<li><a th:href="@{/rss/admin}" class="dropdown-item menufont"><i class="fas fa-rss"></i>&nbsp;RSS-Link</a></li>
<li><a th:href="@{/admin/mail}" class="dropdown-item menufont">Testmail</a></li>
<li><a th:href="@{/admin/document}" class="dropdown-item menufont">Dokumente</a></li>
<li><a th:href="@{/admin/location}" class="dropdown-item menufont">Freizeitheime</a></li>
<!-- TODO: implementation not yet finished -->
<li><a th:href="@{/admin/camp}" class="dropdown-item menufont">Freizeiten</a>
<!-- -->
<li class="dropdown dropend">
<a class="dropdown-item dropdown-toggle menufont" href="#" role="button" data-bs-auto-close='outside' data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Rechteverwaltung</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item menufont" th:href="@{/admin/privileges/userbased}">nutzerzentriert</a></li>
<li><a class="dropdown-item menufont" th:href="@{/admin/privileges/rolebased}">rollenzentriert</a></li>
<li><a class="dropdown-item menufont" th:href="@{/admin/privileges/campbased}">freizeitzentriert</a></li>
</ul></li>
</ul>
</div>
</li>
@ -156,8 +153,7 @@
</span>
</div>
<div class="col-md-2">
<a th:href="@{/impressum}">Impressum</a>&nbsp;&nbsp;
<a th:href="@{/datenschutz}">Datenschutz</a>
<a th:href="@{/impressum}">Impressum</a>&nbsp;&nbsp; <a th:href="@{/datenschutz}">Datenschutz</a>
</div>
</div>
</div>