-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/home 1780 permissions overhaul api (#479)
* HOME-1780: basic new fields added and template model * HOME-1780: added roles and tests
- Loading branch information
1 parent
5e4421e
commit b8e821e
Showing
9 changed files
with
141 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import {BaseCollection} from "./base_collection.js"; | ||
import {PermissionTemplate} from "../models/permission_template.js"; | ||
import type {TeamOnly} from "../types/index.js"; | ||
import type {PaginatedResult} from "../interfaces/index.js"; | ||
|
||
|
||
export class PermissionTemplates extends BaseCollection { | ||
protected static prefixURI = "teams/{!:team_id}/roles"; | ||
protected static elementClass = PermissionTemplate; | ||
protected static rootElementName = "roles" | ||
|
||
list( | ||
request_params: TeamOnly, | ||
): Promise<PaginatedResult<PermissionTemplate>> { | ||
return this.doList(request_params); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export interface PermissionTemplate { | ||
id: number; | ||
role: string; | ||
permissions: string[]; | ||
description: string; | ||
tag: string; | ||
tagColor: string; | ||
doesEnableAllReadOnlyLanguages: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { PermissionTemplate as PermissionTemplateInterface } from "../interfaces/permission_template.js"; | ||
import { BaseModel } from "./base_model.js"; | ||
|
||
export class PermissionTemplate extends BaseModel implements PermissionTemplateInterface { | ||
declare id: number; | ||
declare role: string; | ||
declare permissions: string[]; | ||
declare description: string; | ||
declare tag: string; | ||
declare tagColor: string; | ||
declare doesEnableAllReadOnlyLanguages: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
{ | ||
"roles": [ | ||
{ | ||
"id": 1, | ||
"role": "Localisation management", | ||
"permissions": [ | ||
"activity", | ||
"branches_main_modify", | ||
"branches_create", | ||
"branches_merge", | ||
"statistics", | ||
"tasks", | ||
"contributors", | ||
"settings", | ||
"manage_languages", | ||
"download", | ||
"upload", | ||
"glossary_delete", | ||
"glossary_edit", | ||
"manage_keys", | ||
"screenshots", | ||
"custom_status_modify" | ||
], | ||
"description": "Manage project settings, contributors and tasks", | ||
"tag": "Full access", | ||
"tagColor": "green", | ||
"doesEnableAllReadOnlyLanguages": true | ||
}, | ||
{ | ||
"id": 2, | ||
"role": "Developer", | ||
"permissions": [ | ||
"activity", | ||
"branches_main_modify", | ||
"branches_create", | ||
"download", | ||
"upload", | ||
"manage_keys", | ||
"screenshots" | ||
], | ||
"description": "Create keys, upload and download content", | ||
"tag": "Advanced", | ||
"tagColor": "cyan", | ||
"doesEnableAllReadOnlyLanguages": true | ||
}, | ||
{ | ||
"id": 3, | ||
"role": "Content creator", | ||
"permissions": [ | ||
"activity", | ||
"manage_keys", | ||
"manage_languages", | ||
"screenshots", | ||
"branches_main_modify" | ||
], | ||
"description": "Create, translate and edit keys, manage screenshots", | ||
"tag": "Advanced", | ||
"tagColor": "cyan", | ||
"doesEnableAllReadOnlyLanguages": true | ||
}, | ||
{ | ||
"id": 4, | ||
"role": "Reviewer", | ||
"permissions": [ | ||
"branches_main_modify", | ||
"review", | ||
"custom_status_modify" | ||
], | ||
"description": "Translate keys, control key statuses", | ||
"tag": "Basic", | ||
"tagColor": "grey", | ||
"doesEnableAllReadOnlyLanguages": false | ||
}, | ||
{ | ||
"id": 5, | ||
"role": "Translator", | ||
"permissions": [ | ||
"branches_main_modify" | ||
], | ||
"description": "Translate keys", | ||
"tag": "Basic", | ||
"tagColor": "grey", | ||
"doesEnableAllReadOnlyLanguages": false | ||
} | ||
] | ||
} |