mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-09 09:20:54 +00:00
Hide restricted widgets & settings for readonly role
Signed-off-by: Anton Alexeyev <alexeyev.anton@gmail.com>
This commit is contained in:
parent
cc22bbfc0f
commit
7fbc6b88a2
@ -35,7 +35,8 @@ import {
|
||||
type Markup,
|
||||
type Ref,
|
||||
type Timestamp,
|
||||
type PersonId
|
||||
type PersonId,
|
||||
AccountRole
|
||||
} from '@hcengineering/core'
|
||||
import {
|
||||
ArrOf,
|
||||
@ -195,7 +196,8 @@ export function createModel (builder: Builder): void {
|
||||
label: calendar.string.Calendar,
|
||||
type: WidgetType.Fixed,
|
||||
icon: calendar.icon.Calendar,
|
||||
component: calendar.component.CalendarWidget
|
||||
component: calendar.component.CalendarWidget,
|
||||
accessLevel: AccountRole.DocGuest
|
||||
},
|
||||
calendar.ids.CalendarWidget
|
||||
)
|
||||
|
@ -299,7 +299,8 @@ export function createModel (builder: Builder): void {
|
||||
label: love.string.Office,
|
||||
type: WidgetType.Fixed,
|
||||
icon: love.icon.Love,
|
||||
component: love.component.LoveWidget
|
||||
component: love.component.LoveWidget,
|
||||
accessLevel: AccountRole.DocGuest
|
||||
},
|
||||
love.ids.LoveWidget
|
||||
)
|
||||
|
@ -112,13 +112,15 @@
|
||||
let actions: Action[] = []
|
||||
$: {
|
||||
actions = []
|
||||
actions.push({
|
||||
icon: view.icon.Setting,
|
||||
label: setting.string.Settings,
|
||||
action: async () => {
|
||||
selectCategory()
|
||||
}
|
||||
})
|
||||
if (hasAccountRole(account, AccountRole.DocGuest)) {
|
||||
actions.push({
|
||||
icon: view.icon.Setting,
|
||||
label: setting.string.Settings,
|
||||
action: async () => {
|
||||
selectCategory()
|
||||
}
|
||||
})
|
||||
}
|
||||
actions.push(...getMenu(items, ['main']))
|
||||
if (hasAccountRole(account, AccountRole.User)) {
|
||||
actions.push({
|
||||
|
@ -21,10 +21,16 @@
|
||||
import { sidebarStore, SidebarVariant } from '../../sidebar'
|
||||
import SidebarExpanded from './SidebarExpanded.svelte'
|
||||
import SidebarMini from './SidebarMini.svelte'
|
||||
import { isAppAllowed } from '../../utils'
|
||||
import { getCurrentAccount } from '@hcengineering/core'
|
||||
|
||||
const account = getCurrentAccount()
|
||||
const client = getClient()
|
||||
|
||||
const widgets = client.getModel().findAllSync(workbench.class.Widget, {})
|
||||
const widgets = client
|
||||
.getModel()
|
||||
.findAllSync(workbench.class.Widget, {})
|
||||
.filter((it) => isAppAllowed(it, account))
|
||||
const preferencesQuery = createQuery()
|
||||
|
||||
let preferences: WidgetPreference[] = []
|
||||
|
@ -74,6 +74,8 @@ export interface Widget extends Doc {
|
||||
|
||||
closeIfNoTabs?: boolean
|
||||
onTabClose?: Resource<(tab: WidgetTab) => Promise<void>>
|
||||
|
||||
accessLevel?: AccountRole
|
||||
}
|
||||
|
||||
/** @public */
|
||||
|
Loading…
Reference in New Issue
Block a user