mirror of
https://github.com/outline/outline.git
synced 2026-12-01 09:22:14 +03:00
self review
This commit is contained in:
1 parent
8656c21e14
commit
eb3f74cf21
4 files changed
+14
-11
No files matched your search
Whitespace-only changes.
@@ -66,7 +66,12 @@ export default class AuthenticationHelper {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the given path can be accessed with any of the scopes.
|
||||
* Returns whether the given path can be accessed with any of the scopes. We
|
||||
* support scopes in the formats of:
|
||||
*
|
||||
* - `/api/namespace.method`
|
||||
* - `namespace:scope`
|
||||
* - `scope`
|
||||
*
|
||||
* @param path The path to check
|
||||
* @param scopes The scopes to check
|
||||
|
||||
@@ -1,18 +1,9 @@
|
||||
import { TeamPreference } from "@shared/types";
|
||||
import { Team, User, OAuthClient } from "@server/models";
|
||||
import { allow } from "./cancan";
|
||||
import { or, isTeamModel, isTeamMutable, and, isTeamAdmin } from "./utils";
|
||||
|
||||
allow(User, "createOAuthClient", Team, (actor, team) =>
|
||||
and(
|
||||
isTeamModel(actor, team),
|
||||
isTeamMutable(actor),
|
||||
!actor.isViewer,
|
||||
!actor.isGuest,
|
||||
!actor.isSuspended,
|
||||
actor.isAdmin ||
|
||||
!!team?.getPreference(TeamPreference.MembersCanCreateApiKey)
|
||||
)
|
||||
and(isTeamModel(actor, team), isTeamMutable(actor), actor.isAdmin)
|
||||
);
|
||||
|
||||
allow(User, "listOAuthClients", Team, (actor, team) =>
|
||||
|
||||
@@ -17,6 +17,13 @@ export default function presentOAuthClient(oauthClient: OAuthClient) {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Important: This function is used to present the OAuth client to users
|
||||
* that are not in the same workspace as the client. Be very careful about
|
||||
* what you expose here.
|
||||
*
|
||||
* @param oauthClient The OAuth client to present
|
||||
*/
|
||||
export function presentPublishedOAuthClient(oauthClient: OAuthClient) {
|
||||
return {
|
||||
name: oauthClient.name,
|
||||
|
||||
Reference in new issue
Block a user