Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Hide 'New' and 'Save' buttons on the templates UI if there's no manage permission.

Kailash Nadh953deef4123e
diff --git a/cmd/auth.go b/cmd/auth.go
index c202a56b..b403fe2e 100644
--- a/cmd/auth.go
+++ b/cmd/auth.go
@@ -187,11 +187,14 @@ func (a *App) renderLoginPage(c echo.Context, loginErr error) error {
}
var (
- oidcProviderName = a.cfg.Security.OIDC.ProviderName
+ oidcProviderName = ""
oidcLogo = ""
)
if a.cfg.Security.OIDC.Enabled {
+ // Defaults.
+ oidcProviderName = a.cfg.Security.OIDC.ProviderName
oidcLogo = "oidc.png"
+
u, err := url.Parse(a.cfg.Security.OIDC.ProviderURL)
if err == nil {
h := strings.Split(u.Hostname(), ".")
diff --git a/frontend/src/views/TemplateForm.vue b/frontend/src/views/TemplateForm.vue
index b1d5d91b..a10f9433 100644
--- a/frontend/src/views/TemplateForm.vue
+++ b/frontend/src/views/TemplateForm.vue
@@ -74,7 +74,7 @@
<b-button @click="$parent.close()">
{{ $t('globals.buttons.close') }}
</b-button>
- <b-button native-type="submit" type="is-primary" :loading="loading.templates">
+ <b-button v-if="$can('templates:manage')" native-type="submit" type="is-primary" :loading="loading.templates">
{{ $t('globals.buttons.save') }}
</b-button>
</footer>
diff --git a/frontend/src/views/Templates.vue b/frontend/src/views/Templates.vue
index 5755e35c..fd0b0c48 100644
--- a/frontend/src/views/Templates.vue
+++ b/frontend/src/views/Templates.vue
@@ -8,7 +8,7 @@
</h1>
</div>
<div class="column has-text-right">
- <b-field expanded>
+ <b-field v-if="$can('templates:manage')" expanded>
<b-button expanded type="is-primary" icon-left="plus" class="btn-new" @click="showNewForm">
{{ $t('globals.buttons.new') }}
</b-button>