mirror of
https://github.com/outline/outline.git
synced 2026-12-01 09:22:14 +03:00
Readable scopes
This commit is contained in:
1 parent
180d17e173
commit
aed55c7cfd
1 file changed
+10
-3
@@ -5,9 +5,9 @@ import uniq from "lodash/uniq";
|
||||
export class OAuthScopeHelper {
|
||||
public static normalizeScopes(scopes: string[]): string[] {
|
||||
const methodToReadable = {
|
||||
list: t("read"),
|
||||
info: t("read"),
|
||||
read: t("read"),
|
||||
list: t("view"),
|
||||
info: t("view"),
|
||||
read: t("view"),
|
||||
write: t("write"),
|
||||
create: t("write"),
|
||||
update: t("write"),
|
||||
@@ -34,6 +34,13 @@ export class OAuthScopeHelper {
|
||||
};
|
||||
|
||||
const normalizedScopes = scopes.map((scope) => {
|
||||
if (scope === "read") {
|
||||
return t("View workspace");
|
||||
}
|
||||
if (scope === "write") {
|
||||
return t("View workspace");
|
||||
}
|
||||
|
||||
const [namespace, method] = scope.replace("/api/", "").split(/[:\.]/g);
|
||||
const readableMethod =
|
||||
methodToReadable[method as keyof typeof methodToReadable] ?? method;
|
||||
|
||||
Reference in new issue
Block a user