mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Allowing non-owner managers to add other managers
Summary: Billing managers can now add other billing managers. Before only managers with owner access could do that. Test Plan: Added test Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D4339
This commit is contained in:
@@ -2031,9 +2031,10 @@ export enum TestUserEnum {
|
||||
support = 'support',
|
||||
}
|
||||
export type TestUser = keyof typeof TestUserEnum; // 'user1' | 'user2' | ...
|
||||
export interface UserData { email: string, name: string }
|
||||
|
||||
// Get name and email for the given test user.
|
||||
export function translateUser(userName: TestUser): {email: string, name: string} {
|
||||
export function translateUser(userName: TestUser): UserData {
|
||||
if (userName === 'anon') {
|
||||
return {email: 'anon@getgrist.com', name: 'Anonymous'};
|
||||
}
|
||||
@@ -2102,8 +2103,11 @@ export class Session {
|
||||
}
|
||||
|
||||
// Return a session configured for the current session's site but a different user.
|
||||
public user(userName: TestUser = 'user1') {
|
||||
return new Session({...this.settings, ...translateUser(userName)});
|
||||
public user(userName?: TestUser): Session
|
||||
public user(user: UserData): Session
|
||||
public user(arg: TestUser|UserData = 'user1') {
|
||||
const data = typeof arg === 'string' ? translateUser(arg) : arg;
|
||||
return new Session({...this.settings, ...data});
|
||||
}
|
||||
|
||||
// Return a session configured for the current session's site and anonymous access.
|
||||
|
||||
Reference in New Issue
Block a user