add "only platform admin can create groups" and "only groups can create events" restrictions

This commit is contained in:
setop
2021-10-06 18:00:50 +02:00
committed by Thomas Citharel
parent 7885151220
commit 7940d69d5a
13 changed files with 135 additions and 34 deletions

View File

@@ -10,7 +10,7 @@
)
}}
</p>
<div class="buttons">
<div class="buttons" v-if="!hideCreateEventButton">
<router-link
class="button is-primary"
:to="{ name: RouteName.CREATE_EVENT }"
@@ -126,6 +126,8 @@
</template>
<script lang="ts">
import { CONFIG } from "../../graphql/config";
import { IConfig } from "../../types/config.model";
import { Component, Vue } from "vue-property-decorator";
import { ParticipantRole } from "@/types/enums";
import RouteName from "@/router/name";
@@ -147,6 +149,7 @@ import Subtitle from "../../components/Utils/Subtitle.vue";
EventListCard,
},
apollo: {
config: CONFIG,
futureParticipations: {
query: LOGGED_USER_PARTICIPATIONS,
fetchPolicy: "cache-and-network",
@@ -197,6 +200,8 @@ export default class MyEvents extends Vue {
limit = 10;
config!: IConfig;
futureParticipations: IParticipant[] = [];
hasMoreFutureParticipations = true;
@@ -286,6 +291,10 @@ export default class MyEvents extends Vue {
(participation) => participation.event.id !== eventid
);
}
get hideCreateEventButton(): boolean {
return !!this.config?.restrictions?.onlyGroupsCanCreateEvents;
}
}
</script>