ROLE_COUNTER
This commit is contained in:
@@ -9,6 +9,8 @@ public final class AuthoritiesConstants {
|
||||
|
||||
public static final String USER = "ROLE_USER";
|
||||
|
||||
public static final String COUNTER = "ROLE_COUNTER";
|
||||
|
||||
public static final String ANONYMOUS = "ROLE_ANONYMOUS";
|
||||
|
||||
private AuthoritiesConstants() {}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class EventResource {
|
||||
* @throws URISyntaxException if the Location URI syntax is incorrect.
|
||||
*/
|
||||
@PostMapping("")
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
@Secured({ AuthoritiesConstants.ADMIN, AuthoritiesConstants.COUNTER })
|
||||
public ResponseEntity<Event> createEvent(@Valid @RequestBody Event event) throws URISyntaxException {
|
||||
LOG.debug("REST request to save Event : {}", event);
|
||||
if (event.getId() != null) {
|
||||
@@ -65,7 +65,7 @@ public class EventResource {
|
||||
}
|
||||
|
||||
@PostMapping("/{id}/settle")
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
@Secured({ AuthoritiesConstants.ADMIN, AuthoritiesConstants.COUNTER })
|
||||
public ResponseEntity<Optional<Event>> settleEvent(@RequestBody Optional<Event> event) throws URISyntaxException {
|
||||
event = eventService.settle(event.orElse(null));
|
||||
return ResponseEntity.ok()
|
||||
@@ -84,7 +84,7 @@ public class EventResource {
|
||||
* @throws URISyntaxException if the Location URI syntax is incorrect.
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
@Secured({ AuthoritiesConstants.ADMIN, AuthoritiesConstants.COUNTER })
|
||||
public ResponseEntity<Event> updateEvent(@PathVariable(value = "id", required = false) final Long id, @Valid @RequestBody Event event)
|
||||
throws URISyntaxException {
|
||||
LOG.debug("REST request to update Event : {}, {}", id, event);
|
||||
@@ -116,7 +116,7 @@ public class EventResource {
|
||||
* or with status {@code 500 (Internal Server Error)} if the event couldn't be updated.
|
||||
* @throws URISyntaxException if the Location URI syntax is incorrect.
|
||||
*/
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
@Secured({ AuthoritiesConstants.ADMIN, AuthoritiesConstants.COUNTER })
|
||||
@PatchMapping(value = "/{id}", consumes = { "application/json", "application/merge-patch+json" })
|
||||
public ResponseEntity<Event> partialUpdateEvent(
|
||||
@PathVariable(value = "id", required = false) final Long id,
|
||||
|
||||
@@ -50,7 +50,7 @@ public class TransactionResource {
|
||||
* @throws URISyntaxException if the Location URI syntax is incorrect.
|
||||
*/
|
||||
@PostMapping("")
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
@Secured({ AuthoritiesConstants.ADMIN, AuthoritiesConstants.COUNTER })
|
||||
public ResponseEntity<Transaction> createTransaction(@RequestBody Transaction transaction) throws URISyntaxException {
|
||||
LOG.debug("REST request to save Transaction : {}", transaction);
|
||||
if (transaction.getId() != null) {
|
||||
@@ -72,7 +72,7 @@ public class TransactionResource {
|
||||
* or with status {@code 500 (Internal Server Error)} if the transaction couldn't be updated.
|
||||
* @throws URISyntaxException if the Location URI syntax is incorrect.
|
||||
*/
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
@Secured({ AuthoritiesConstants.ADMIN, AuthoritiesConstants.COUNTER })
|
||||
@PutMapping("/{id}")
|
||||
public ResponseEntity<Transaction> updateTransaction(
|
||||
@PathVariable(value = "id", required = false) final Long id,
|
||||
@@ -107,7 +107,7 @@ public class TransactionResource {
|
||||
* or with status {@code 500 (Internal Server Error)} if the transaction couldn't be updated.
|
||||
* @throws URISyntaxException if the Location URI syntax is incorrect.
|
||||
*/
|
||||
@Secured({ AuthoritiesConstants.ADMIN })
|
||||
@Secured({ AuthoritiesConstants.ADMIN, AuthoritiesConstants.COUNTER })
|
||||
@PatchMapping(value = "/{id}", consumes = { "application/json", "application/merge-patch+json" })
|
||||
public ResponseEntity<Transaction> partialUpdateTransaction(
|
||||
@PathVariable(value = "id", required = false) final Long id,
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<font-awesome-icon icon="plus"></font-awesome-icon> <span>Dołącz do wydarzenia</span>
|
||||
</button>
|
||||
</router-link>
|
||||
<button class="btn btn-primary float-right" v-if="hasAnyAuthority('ROLE_ADMIN')" @click="settle()">
|
||||
<button class="btn btn-primary float-right" v-if="hasAnyAuthority(['ROLE_ADMIN', 'ROLE_COUNTER'])" @click="settle()">
|
||||
<font-awesome-icon icon="sync"></font-awesome-icon> <span>Rozlicz wydarzenie</span>
|
||||
</button>
|
||||
<div class="table-responsive" v-if="event.registrations && event.registrations.length > 0">
|
||||
@@ -77,7 +77,8 @@
|
||||
class="btn btn-sm"
|
||||
data-cy="entityDeleteButton"
|
||||
v-if="
|
||||
((registration.id && registration.user?.id == currentUserId && isCurrentEvent) || hasAnyAuthority('ROLE_ADMIN')) &&
|
||||
((registration.id && registration.user?.id == currentUserId && isCurrentEvent) ||
|
||||
hasAnyAuthority(['ROLE_ADMIN', 'ROLE_COUNTER'])) &&
|
||||
registration.active !== false
|
||||
"
|
||||
v-b-modal.removeEntity
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
custom
|
||||
v-slot="{ navigate }"
|
||||
>
|
||||
<button @click="navigate" class="btn btn-primary" v-if="hasAnyAuthority('ROLE_ADMIN')">
|
||||
<button @click="navigate" class="btn btn-primary" v-if="hasAnyAuthority(['ROLE_ADMIN', 'ROLE_COUNTER'])">
|
||||
<font-awesome-icon icon="pencil-alt"></font-awesome-icon> <span>Edit</span>
|
||||
</button>
|
||||
</router-link>
|
||||
@@ -50,7 +50,7 @@
|
||||
custom
|
||||
v-slot="{ navigate }"
|
||||
>
|
||||
<button @click="navigate" class="btn btn-primary" v-if="hasAnyAuthority('ROLE_ADMIN')">
|
||||
<button @click="navigate" class="btn btn-primary" v-if="hasAnyAuthority(['ROLE_ADMIN', 'ROLE_COUNTER'])">
|
||||
<font-awesome-icon icon="pencil-alt"></font-awesome-icon> <span>Create opposite transaction</span>
|
||||
</button>
|
||||
</router-link>
|
||||
|
||||
@@ -6,7 +6,12 @@
|
||||
<button class="btn btn-info mr-2" @click="handleSyncList" :disabled="isFetching">
|
||||
<font-awesome-icon icon="sync" :spin="isFetching"></font-awesome-icon> <span>Refresh list</span>
|
||||
</button>
|
||||
<router-link :to="{ name: 'TransactionCreate' }" custom v-slot="{ navigate }" v-if="hasAnyAuthority('ROLE_ADMIN')">
|
||||
<router-link
|
||||
:to="{ name: 'TransactionCreate' }"
|
||||
custom
|
||||
v-slot="{ navigate }"
|
||||
v-if="hasAnyAuthority(['ROLE_ADMIN', 'ROLE_COUNTER'])"
|
||||
>
|
||||
<button
|
||||
@click="navigate"
|
||||
id="jh-create-entity"
|
||||
@@ -94,7 +99,7 @@
|
||||
:to="{ name: 'TransactionEdit', params: { transactionId: transaction.id } }"
|
||||
custom
|
||||
v-slot="{ navigate }"
|
||||
v-if="hasAnyAuthority('ROLE_ADMIN')"
|
||||
v-if="hasAnyAuthority(['ROLE_ADMIN', 'ROLE_COUNTER'])"
|
||||
>
|
||||
<button @click="navigate" class="btn btn-primary btn-sm edit" data-cy="entityEditButton">
|
||||
<font-awesome-icon icon="pencil-alt"></font-awesome-icon>
|
||||
|
||||
Reference in New Issue
Block a user