teableio/teable

View on GitHub
packages/core/src/auth/role/constant.ts

Summary

Maintainability
A
0 mins
Test Coverage
/* eslint-disable @typescript-eslint/naming-convention */
import type { Action } from '../actions';
import { Role, type IRole } from './types';

export const RolePermission: Record<IRole, Record<Action, boolean>> = {
  [Role.Owner]: {
    'space|create': true,
    'space|delete': true,
    'space|read': true,
    'space|update': true,
    'space|invite_email': true,
    'space|invite_link': true,
    'space|grant_role': true,
    'base|create': true,
    'base|delete': true,
    'base|read': true,
    'base|update': true,
    'base|invite_email': true,
    'base|invite_link': true,
    'base|table_import': true,
    'base|table_export': true,
    'base|authority_matrix_config': true,
    'base|db_connection': true,
    'base|query_data': true,
    'table|create': true,
    'table|read': true,
    'table|delete': true,
    'table|update': true,
    'table|import': true,
    'table|export': true,
    'table_record_history|read': true,
    'view|create': true,
    'view|delete': true,
    'view|read': true,
    'view|update': true,
    'view|share': true,
    'field|create': true,
    'field|delete': true,
    'field|read': true,
    'field|update': true,
    'record|create': true,
    'record|comment': true,
    'record|delete': true,
    'record|read': true,
    'record|update': true,
    'automation|create': true,
    'automation|delete': true,
    'automation|read': true,
    'automation|update': true,
    'user|email_read': true,
    'instance|read': false,
    'instance|update': false,
  },
  [Role.Creator]: {
    'space|create': false,
    'space|delete': false,
    'space|update': false,
    'space|read': true,
    'space|invite_email': true,
    'space|invite_link': true,
    'space|grant_role': false,
    'base|create': true,
    'base|delete': true,
    'base|read': true,
    'base|update': true,
    'base|invite_email': true,
    'base|invite_link': true,
    'base|table_import': true,
    'base|table_export': true,
    'base|authority_matrix_config': true,
    'base|db_connection': false,
    'base|query_data': true,
    'table|create': true,
    'table|read': true,
    'table|delete': true,
    'table|update': true,
    'table|import': true,
    'table|export': true,
    'table_record_history|read': true,
    'view|create': true,
    'view|delete': true,
    'view|read': true,
    'view|update': true,
    'view|share': true,
    'field|create': true,
    'field|delete': true,
    'field|read': true,
    'field|update': true,
    'record|create': true,
    'record|comment': true,
    'record|delete': true,
    'record|read': true,
    'record|update': true,
    'automation|create': true,
    'automation|delete': true,
    'automation|read': true,
    'automation|update': true,
    'user|email_read': true,
    'instance|read': false,
    'instance|update': false,
  },
  [Role.Editor]: {
    'space|create': false,
    'space|delete': false,
    'space|update': false,
    'space|read': true,
    'space|invite_email': true,
    'space|invite_link': false,
    'space|grant_role': false,
    'base|create': false,
    'base|delete': false,
    'base|read': true,
    'base|update': false,
    'base|invite_email': true,
    'base|invite_link': false,
    'base|table_import': true,
    'base|table_export': true,
    'base|authority_matrix_config': false,
    'base|db_connection': false,
    'base|query_data': false,
    'table|create': false,
    'table|read': true,
    'table|delete': false,
    'table|update': false,
    'table|import': false,
    'table|export': true,
    'table_record_history|read': true,
    'view|create': true,
    'view|delete': true,
    'view|read': true,
    'view|update': true,
    'view|share': true,
    'field|create': false,
    'field|delete': false,
    'field|read': true,
    'field|update': false,
    'record|create': true,
    'record|comment': true,
    'record|delete': true,
    'record|read': true,
    'record|update': true,
    'automation|create': false,
    'automation|delete': false,
    'automation|read': true,
    'automation|update': false,
    'user|email_read': true,
    'instance|read': false,
    'instance|update': false,
  },
  [Role.Commenter]: {
    'space|create': false,
    'space|delete': false,
    'space|update': false,
    'space|read': true,
    'space|invite_email': true,
    'space|invite_link': false,
    'space|grant_role': false,
    'base|create': false,
    'base|delete': false,
    'base|read': true,
    'base|update': false,
    'base|invite_email': true,
    'base|invite_link': false,
    'base|table_import': false,
    'base|table_export': true,
    'base|authority_matrix_config': false,
    'base|db_connection': false,
    'base|query_data': false,
    'table|create': false,
    'table|read': true,
    'table|delete': false,
    'table|update': false,
    'table|import': false,
    'table|export': true,
    'table_record_history|read': false,
    'view|create': false,
    'view|delete': false,
    'view|read': true,
    'view|update': false,
    'view|share': false,
    'field|create': false,
    'field|delete': false,
    'field|read': true,
    'field|update': false,
    'record|create': false,
    'record|comment': true,
    'record|delete': false,
    'record|read': true,
    'record|update': false,
    'automation|create': false,
    'automation|delete': false,
    'automation|read': true,
    'automation|update': false,
    'user|email_read': true,
    'instance|read': false,
    'instance|update': false,
  },
  [Role.Viewer]: {
    'space|create': false,
    'space|delete': false,
    'space|update': false,
    'space|read': true,
    'space|invite_email': true,
    'space|invite_link': false,
    'space|grant_role': false,
    'base|create': false,
    'base|delete': false,
    'base|read': true,
    'base|update': false,
    'base|invite_email': true,
    'base|invite_link': false,
    'base|table_import': false,
    'base|table_export': true,
    'base|authority_matrix_config': false,
    'base|db_connection': false,
    'base|query_data': false,
    'table|create': false,
    'table|read': true,
    'table|delete': false,
    'table|update': false,
    'table|import': false,
    'table|export': true,
    'table_record_history|read': false,
    'view|create': false,
    'view|delete': false,
    'view|read': true,
    'view|update': false,
    'view|share': false,
    'field|create': false,
    'field|delete': false,
    'field|read': true,
    'field|update': false,
    'record|create': false,
    'record|comment': false,
    'record|delete': false,
    'record|read': true,
    'record|update': false,
    'automation|create': false,
    'automation|delete': false,
    'automation|read': true,
    'automation|update': false,
    'user|email_read': true,
    'instance|read': false,
    'instance|update': false,
  },
};