Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2024-02-28 14:15:07 +06:00 committed by GitHub
parent 00df852580
commit 3e7e3cab66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 18 additions and 8 deletions

View File

@ -23,7 +23,7 @@
getFirstName,
getLastName
} from '@hcengineering/contact'
import { AccountRole, Ref, getCurrentAccount } from '@hcengineering/core'
import { AccountRole, Ref, getCurrentAccount, roleOrder } from '@hcengineering/core'
import { AttributeEditor, createQuery, getClient } from '@hcengineering/presentation'
import setting, { IntegrationType } from '@hcengineering/setting'
import { EditBox, FocusHandler, Scroller, createFocusManager } from '@hcengineering/ui'
@ -46,7 +46,7 @@
let avatarEditor: EditableAvatar
$: owner = account.person === object._id
$: editable = !readonly && (account.role >= AccountRole.Maintainer || owner)
$: editable = !readonly && (roleOrder[account.role] >= roleOrder[AccountRole.Maintainer] || owner)
let firstName = getFirstName(object.name)
let lastName = getLastName(object.name)

View File

@ -14,7 +14,16 @@
-->
<script lang="ts">
import contact, { Person, PersonAccount, Employee } from '@hcengineering/contact'
import { Account, AccountRole, DocumentQuery, getCurrentAccount, Ref, SortingOrder, Space } from '@hcengineering/core'
import {
Account,
AccountRole,
DocumentQuery,
getCurrentAccount,
Ref,
roleOrder,
SortingOrder,
Space
} from '@hcengineering/core'
import { translate } from '@hcengineering/platform'
import presentation, { getClient } from '@hcengineering/presentation'
import { ActionIcon, IconAdd, IconClose, Label, SearchEdit, showPopup, themeStore } from '@hcengineering/ui'
@ -77,7 +86,7 @@
}
const account = getCurrentAccount()
$: canRemove = account.role >= AccountRole.Maintainer && space.createdBy === account._id
$: canRemove = roleOrder[account.role] >= roleOrder[AccountRole.Maintainer] && space.createdBy === account._id
</script>
<div class="flex-row-reverse mb-3 mt-3"><SearchEdit bind:value={search} /></div>

View File

@ -13,7 +13,7 @@
// limitations under the License.
-->
<script lang="ts">
import { AccountRole, getCurrentAccount, Timestamp } from '@hcengineering/core'
import { AccountRole, getCurrentAccount, roleOrder, Timestamp } from '@hcengineering/core'
import { loginId } from '@hcengineering/login'
import { getMetadata } from '@hcengineering/platform'
import presentation, { copyTextToClipboard, createQuery } from '@hcengineering/presentation'
@ -108,7 +108,7 @@
let limit: number | undefined = undefined
let useDefault: boolean | undefined = true
let noLimit: boolean = false
const isOwnerOrMaintainer: boolean = getCurrentAccount().role > AccountRole.Maintainer
const isOwnerOrMaintainer: boolean = roleOrder[getCurrentAccount().role] > roleOrder[AccountRole.Maintainer]
let defaultValues: InviteParams = {
expirationTime: 1,
emailMask: '',

View File

@ -23,7 +23,8 @@ import core, {
type Client,
type Doc,
type Ref,
type WithLookup
type WithLookup,
roleOrder
} from '@hcengineering/core'
import { getResource } from '@hcengineering/platform'
import { getClient } from '@hcengineering/presentation'
@ -198,7 +199,7 @@ export function filterActions (
if (ignore.includes(action._id)) {
continue
}
if (role < AccountRole.Maintainer && action.secured === true) {
if (roleOrder[role] < roleOrder[AccountRole.Maintainer] && action.secured === true) {
continue
}
if (