(core) Show usage banners in doc menu of free team sites

Summary:
Also fixes a minor CSS regression in UserManager where the
link to add a team member wasn't shown on a separate row.

Test Plan: Browser tests.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D3444
This commit is contained in:
George Gevoian
2022-05-25 23:47:26 -07:00
parent 2f3cf59fc3
commit 74ec9358da
16 changed files with 341 additions and 213 deletions

View File

@@ -1,3 +1,5 @@
import {Organization} from 'app/common/UserAPI';
export const OWNER = 'owners';
export const EDITOR = 'editors';
export const VIEWER = 'viewers';
@@ -39,6 +41,15 @@ export function canView(role: string|null): boolean {
return role !== null;
}
export function isOwner(resource: {access: Role}|null): resource is {access: Role} {
return resource?.access === OWNER;
}
export function canUpgradeOrg(org: Organization|null): org is Organization {
// TODO: Need to consider billing managers and support user.
return isOwner(org);
}
// Returns true if the role string is a valid role or null.
export function isValidRole(role: string|null): role is Role|null {
return (roleOrder as Array<string|null>).includes(role);