Add MembersCanCreateApiKey team preference
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { TeamPreference } from "@shared/types";
|
||||
import { ApiKey, User, Team } from "@server/models";
|
||||
import { allow } from "./cancan";
|
||||
import { and, isOwner, isTeamModel, isTeamMutable } from "./utils";
|
||||
@@ -9,7 +10,9 @@ allow(User, "createApiKey", Team, (actor, team) =>
|
||||
isTeamMutable(actor),
|
||||
!actor.isViewer,
|
||||
!actor.isGuest,
|
||||
!actor.isSuspended
|
||||
!actor.isSuspended,
|
||||
actor.isAdmin ||
|
||||
!!team?.getPreference(TeamPreference.MembersCanCreateApiKey)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -39,6 +39,8 @@ export const TeamsUpdateSchema = BaseSchema.extend({
|
||||
viewersCanExport: z.boolean().optional(),
|
||||
/** Whether members can invite new people to the team. */
|
||||
membersCanInvite: z.boolean().optional(),
|
||||
/** Whether members can create API keys. */
|
||||
membersCanCreateApiKey: z.boolean().optional(),
|
||||
/** Whether commenting is enabled */
|
||||
commenting: z.boolean().optional(),
|
||||
/** The custom theme for the team. */
|
||||
|
||||
Reference in New Issue
Block a user