ede566eed9
* prep for new resources algo * typescriptifying stuff * minor types fix * migrate to resources col * repo & creation updated, WIP processing/retrieval * WIP invite processing * finished finalization refactor * project invite management * transformed all invites services * fixed up projects & core serverinvites resolvers * test fixes * WIP workspace create GQL & test * basic invite creation test works * a buncha working tests * more tests * cancelation tests * minor invite use refactor * invite retrieval tasks * invite use() works as expected * filtering out broken invites * enabled invite retrieval by token irregardless of who is it for * minor adjustments * tests fix * test config improvements * test env adjustment * extra test case * making resource access limits harder to ignore * linter fixes * eventBus type cleanup * better generic names * refactored serverinvites resource migration * fix(server): better error message in project invite edge case
43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
import { Roles, Scopes, AllScopes as BaseAllScopes } from '@speckle/shared'
|
|
import { getFeatureFlags } from '@/modules/shared/helpers/envHelper'
|
|
|
|
const { FF_AUTOMATE_MODULE_ENABLED, FF_WORKSPACES_MODULE_ENABLED } = getFeatureFlags()
|
|
|
|
const buildAllScopes = () => {
|
|
let base = BaseAllScopes
|
|
|
|
if (!FF_AUTOMATE_MODULE_ENABLED) {
|
|
base = base.filter(
|
|
(s: string) =>
|
|
!(
|
|
[
|
|
Scopes.AutomateFunctions.Read,
|
|
Scopes.AutomateFunctions.Write,
|
|
Scopes.Automate.ReportResults
|
|
] as string[]
|
|
).includes(s)
|
|
)
|
|
}
|
|
|
|
if (!FF_WORKSPACES_MODULE_ENABLED) {
|
|
base = base.filter(
|
|
(s: string) =>
|
|
!(
|
|
[
|
|
Scopes.Workspaces.Create,
|
|
Scopes.Workspaces.Read,
|
|
Scopes.Workspaces.Update,
|
|
Scopes.Workspaces.Delete
|
|
] as string[]
|
|
).includes(s)
|
|
)
|
|
}
|
|
|
|
return base
|
|
}
|
|
|
|
const AllScopes = buildAllScopes()
|
|
|
|
export type { ServerRoles, StreamRoles } from '@speckle/shared'
|
|
export { Roles, Scopes, AllScopes }
|