Skip to content

TaskView is a self-hosted project and task management platform focused on clarity, ownership, and control. TaskView is built for teams that want a transparent, self-hosted alternative to SaaS task managers.

567 B
Raw Blame
import { computed } from 'vue'
import type { Organization } from 'taskview-api'

export function useOrgPermissions(orgRef: () => Organization | null | undefined) {
  const currentUserRole = computed(() => orgRef()?.currentUserRole ?? 'member')

  const isOwner = computed(() => currentUserRole.value === 'owner')
  const isAdmin = computed(() => currentUserRole.value === 'owner' || currentUserRole.value === 'admin')
  const isMember = computed(() => currentUserRole.value === 'member')

  return {
    currentUserRole,
    isOwner,
    isAdmin,
    isMember,
  }
}