Merge remote-tracking branch 'origin/master'
This commit is contained in:
45
ui/src/modules/activityLogs/index.js
Normal file
45
ui/src/modules/activityLogs/index.js
Normal file
@@ -0,0 +1,45 @@
|
||||
// ui/src/modules/activityLogs/index.js
|
||||
|
||||
export const ACTIVITY_LOGS_ALLOWED_USER_IDS = [5]
|
||||
|
||||
function toNumberOrNull (v) {
|
||||
const n = Number(v)
|
||||
return Number.isFinite(n) ? n : null
|
||||
}
|
||||
|
||||
export function getAuthUserId (authUser) {
|
||||
if (!authUser || typeof authUser !== 'object') return null
|
||||
|
||||
// tolerate backend field naming differences
|
||||
return (
|
||||
toNumberOrNull(authUser.id) ??
|
||||
toNumberOrNull(authUser.ID) ??
|
||||
toNumberOrNull(authUser.user_id) ??
|
||||
toNumberOrNull(authUser.userId) ??
|
||||
null
|
||||
)
|
||||
}
|
||||
|
||||
export function isActivityLogsAllowedUser (authUser) {
|
||||
const id = getAuthUserId(authUser)
|
||||
if (id == null) return false
|
||||
return ACTIVITY_LOGS_ALLOWED_USER_IDS.includes(id)
|
||||
}
|
||||
|
||||
export const activityLogsRoute = {
|
||||
path: 'activity-logs',
|
||||
name: 'activity-logs',
|
||||
component: () => import('pages/ActivityLogs.vue'),
|
||||
meta: {
|
||||
permission: 'system:read',
|
||||
onlyUserIds: ACTIVITY_LOGS_ALLOWED_USER_IDS
|
||||
}
|
||||
}
|
||||
|
||||
export const activityLogsMenuItem = {
|
||||
label: 'Loglar',
|
||||
to: '/app/activity-logs',
|
||||
permission: 'system:read',
|
||||
onlyUserIds: ACTIVITY_LOGS_ALLOWED_USER_IDS
|
||||
}
|
||||
|
||||
13
ui/src/pages/Unauthorized.vue
Normal file
13
ui/src/pages/Unauthorized.vue
Normal file
@@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<q-page class="q-pa-md flex flex-center">
|
||||
<div class="column items-center">
|
||||
<div class="text-negative text-h6 q-mb-sm">Erisim reddedildi</div>
|
||||
<div class="text-grey-7 q-mb-md">Bu sayfayi gormek icin yetkiniz yok.</div>
|
||||
<q-btn color="primary" unelevated label="Ana panele don" to="/app" />
|
||||
</div>
|
||||
</q-page>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user