Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions server/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
"SERVER_TYPE",
"COLLECT_STATISTICS",
"USER_SELF_REGISTRATION",
"GLOBAL_ADMIN",
Comment thread
varmar05 marked this conversation as resolved.
"GLOBAL_READ",
"GLOBAL_WRITE",
]
)
register_stats(application)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-MerginMaps-Commercial
<project-collaborators-view-template
v-if="isProjectOwner"
@share="openShareDialog"
:allow-share="!instanceStore.globalRolesEnabled"
Comment thread
varmar05 marked this conversation as resolved.
:show-access-requests="userStore.isGlobalWorkspaceAdmin"
/>
</template>
Expand All @@ -18,13 +19,15 @@ import {
ProjectCollaboratorsViewTemplate,
useDialogStore,
useProjectStore,
useUserStore
useUserStore,
useInstanceStore
} from '@mergin/lib'
import { computed } from 'vue'

const projectStore = useProjectStore()
const dialogStore = useDialogStore()
const userStore = useUserStore()
const instanceStore = useInstanceStore()

const isProjectOwner = computed(() => projectStore.isProjectOwner)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-MerginMaps-Commercial
:show-namespace="false"
:namespace="namespace"
:only-public="onlyPublic"
:can-create-project="canCreateProject"
@new-project-error="onNewProjectError"
/>
</template>
Expand Down
3 changes: 2 additions & 1 deletion web-app/packages/lib/src/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-MerginMaps-Commercial

import { getAvatar } from './mergin_utils'

import {
formatDate,
formatDateTime,
Expand All @@ -10,7 +12,6 @@ import {
} from '@/common/date_utils'
import { formatFileSize, formatToCurrency } from '@/common/number_utils'
import { formatToTitle } from '@/common/text_utils'
import { getAvatar } from './mergin_utils'

export * from './components'
export * from './errors'
Expand Down
13 changes: 13 additions & 0 deletions web-app/packages/lib/src/modules/instance/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ export const useInstanceStore = defineStore('instanceModule', {
configData: undefined
}),

getters: {
/**
* Checks if global roles are enabled based on the config data.
* Returns true if any of the global role flags are truthy, false otherwise.
*/
globalRolesEnabled(state): boolean {
// eslint-disable-next-line camelcase
const { global_read, global_write, global_admin } = state.configData
// eslint-disable-next-line camelcase
return [global_read, global_write, global_admin].some((r) => !!r)
}
},

actions: {
setConfigData(payload: ConfigResponse) {
this.configData = payload
Expand Down
3 changes: 3 additions & 0 deletions web-app/packages/lib/src/modules/instance/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export interface BaseConfigResponse {
major?: number
minor?: number
fix?: number
global_read?: boolean
global_write?: boolean
global_admin?: boolean
}

export type ConfigResponse = BaseConfigResponse &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-MerginMaps-Commercial
>
<div class="flex flex-column justify-content-between h-screen">
<div>
<header class="p-2 lg:p-5 mb-2">
<div class="lg:hidden flex justify-content-end">
<header class="p-2 xl:p-5 mb-2">
<div class="xl:hidden flex justify-content-end">
<PButton
plain
icon="ti ti-x"
Expand Down Expand Up @@ -109,7 +109,7 @@ const onCloseClick = () => {
max-width: 16.66%;
}

@media screen and (max-width: $lg) {
@media screen and (max-width: $xl) {
.sidebar {
max-width: 400px;
}
Expand Down
2 changes: 1 addition & 1 deletion web-app/packages/lib/src/modules/layout/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const CLOSED_ELEMENTS_KEY = 'mm-closed-elements'

export const useLayoutStore = defineStore('layoutModule', {
state: (): LayoutState => ({
overlayBreakpoint: 992,
overlayBreakpoint: 1200,
drawer: false,
isUnderOverlayBreakpoint: false,
closedElements: []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ import { mapActions, mapState } from 'pinia'
import { defineComponent } from 'vue'

import { TipMessage } from '@/common/components'
import { useUserStore } from '@/main'
import { useDialogStore } from '@/modules/dialog/store'
import { useFormStore } from '@/modules/form/store'
import { useProjectStore } from '@/modules/project/store'
import { useUserStore } from '@/main'

export default defineComponent({
name: 'new-project-form',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-MerginMaps-Commercial
/>
</span>
<PButton
v-if="allowShare"
@click="$emit('share')"
icon="ti ti-send"
label="Share"
Expand Down Expand Up @@ -63,9 +64,13 @@ import AppSection from '@/common/components/AppSection.vue'
import { useUserStore } from '@/main'

defineEmits<{ share: [] }>()
withDefaults(defineProps<{ showAccessRequests?: boolean }>(), {
showAccessRequests: false
})
withDefaults(
defineProps<{ showAccessRequests?: boolean; allowShare?: boolean }>(),
{
showAccessRequests: false,
allowShare: true
}
)

const projectStore = useProjectStore()
const userStore = useUserStore()
Expand Down