feat(auth): enforce admin permissions in UI
Add can()/router meta, HomePage module filtering, Admins permission matrix, and hide write actions when the user lacks *:write. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -16,9 +16,12 @@ import {
|
||||
type HamkarUiConfig,
|
||||
} from '@/config/defaultHamkarUiConfig'
|
||||
import { resolveHamkarEffectiveTheme } from '@/config/hamkarEffectiveTheme'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const auth = useAuthStore()
|
||||
const canWrite = computed(() => auth.can('hamkar:write'))
|
||||
const loading = ref(true)
|
||||
const saving = ref(false)
|
||||
const resetting = ref(false)
|
||||
@@ -420,6 +423,7 @@ onMounted(load)
|
||||
|
||||
<div class="sticky-actions">
|
||||
<a-button
|
||||
v-if="canWrite"
|
||||
size="large"
|
||||
block
|
||||
:loading="resetting"
|
||||
@@ -428,7 +432,14 @@ onMounted(load)
|
||||
>
|
||||
بازگشت به ظاهر اولیه
|
||||
</a-button>
|
||||
<a-button type="primary" size="large" block :loading="saving" @click="save">
|
||||
<a-button
|
||||
v-if="canWrite"
|
||||
type="primary"
|
||||
size="large"
|
||||
block
|
||||
:loading="saving"
|
||||
@click="save"
|
||||
>
|
||||
ذخیره ظاهر همکار
|
||||
</a-button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user