-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpermissions.interface.ts
More file actions
208 lines (195 loc) · 6.18 KB
/
permissions.interface.ts
File metadata and controls
208 lines (195 loc) · 6.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
// Copyright The Linux Foundation and each contributor to LFX.
// SPDX-License-Identifier: MIT
import { User } from './auth.interface';
import { Committee } from './committee.interface';
import { TagSeverity } from './components.interface';
/**
* Permission levels available in the system
* @description Access control levels for users within projects and committees
*/
export type PermissionLevel = 'read' | 'write';
/**
* Permission scope types
* @description Areas where permissions can be applied
*/
export type PermissionScope = 'project' | 'committee';
/**
* Project-level permission assignment
* @description Grants user access to entire project with specified permission level
*/
export interface ProjectPermission {
/** Unique permission record ID */
id: number;
/** User ID this permission applies to */
user_id: string;
/** Project UID this permission applies to */
project_uid: string;
/** Level of access granted */
permission_level: PermissionLevel;
/** Timestamp when permission was created */
created_at?: string;
/** Timestamp when permission was last updated */
updated_at?: string;
}
/**
* Committee-level permission assignment
* @description Grants user access to specific committee with specified permission level
*/
export interface CommitteePermission {
/** Unique permission record ID */
id: number;
/** User ID this permission applies to */
user_id: string;
/** Project UID containing the committee */
project_uid: string;
/** Committee ID this permission applies to */
committee_id: string;
/** Level of access granted */
permission_level: PermissionLevel;
/** Timestamp when permission was created */
created_at?: string;
/** Timestamp when permission was last updated */
updated_at?: string;
}
/**
* Mailing list entity
* @description Communication channel associated with projects or committees
*/
export interface MailingList {
/** Unique mailing list identifier */
id: string;
/** Mailing list display name */
name: string;
/** Optional description of the mailing list purpose */
description?: string;
/** Associated committee ID (if committee-specific) */
committee_id?: string;
/** Project UID this mailing list belongs to */
project_uid: string;
}
/**
* Comprehensive user permission summary
* @description Complete overview of a user's permissions across project and committees
*/
export interface UserPermissionSummary {
/** User profile information */
user: Partial<User>;
/** Project-level permission (if any) */
projectPermission?: {
/** Permission level granted */
level: PermissionLevel;
/** Scope identifier */
scope: 'project';
};
/** Array of committee-specific permissions */
committeePermissions: {
/** Committee this permission applies to */
committee: Committee;
/** Permission level granted */
level: PermissionLevel;
/** Scope identifier */
scope: 'committee';
}[];
}
/**
* Data required to create user permissions
* @description Input payload for granting permissions to new or existing users
*/
export interface CreateUserPermissionRequest {
/** User's first name */
first_name: string;
/** User's last name */
last_name: string;
/** User's email address */
email: string;
/** User's username (optional) */
username?: string;
/** Project UID to grant permissions for */
project_uid: string;
/** Scope of permission (project or committee level) */
permission_scope: PermissionScope;
/** Level of access to grant */
permission_level: PermissionLevel;
/** Committee IDs (required when scope is 'committee') */
committee_ids?: string[];
}
/**
* Data required to update user permissions
* @description Input payload for modifying existing user permissions
*/
export interface UpdateUserPermissionRequest {
/** User ID to update permissions for */
user_id: string;
/** Project UID the permissions apply to */
project_uid: string;
/** Scope of permission (project or committee level) */
permission_scope: PermissionScope;
/** Level of access to grant */
permission_level: PermissionLevel;
/** Committee IDs (required when scope is 'committee') */
committee_ids?: string[];
}
/**
* Simplified user permission for display
* @description Simplified representation of user permissions for table display
*/
export interface ProjectPermissionUser {
/** User's full name */
name: string;
/** User's email address */
email: string;
/** Username identifier */
username: string;
/** URL to user's avatar image (optional) */
avatar?: string;
/** Permission role - 'view' for auditors, 'manage' for writers */
role: 'view' | 'manage';
}
/**
* Request payload for adding user to project
* @description Data required to add a user to project writers or auditors
* Can include optional manual entry fields when user is not found in directory
*/
export interface AddUserToProjectRequest {
/** Username to add */
username: string;
/** Role to assign - 'view' for auditors, 'manage' for writers */
role: 'view' | 'manage';
/** User's full name (optional, for manual entry when user not found) */
name?: string;
/** User's email address (optional, for manual entry when user not found) */
email?: string;
/** User's avatar URL (optional, for manual entry when user not found) */
avatar?: string;
}
/**
* Request payload for updating user role in project
* @description Data required to change a user's role in project
*/
export interface UpdateUserRoleRequest {
/** New role to assign - 'view' for auditors, 'manage' for writers */
role: 'view' | 'manage';
}
/**
* Permission matrix display item
* @description UI representation of permission capabilities with visual styling
*/
export interface PermissionMatrixItem {
/** Permission scope (project/committee) */
scope: string;
/** Permission level (read/write) */
level: string;
/** Human-readable description of the permission */
description: string;
/** List of capabilities this permission grants */
capabilities: string[];
/** Visual styling for the permission badge */
badge: {
/** Text color */
color: string;
/** Background color */
bgColor: string;
/** Semantic severity level for tag component */
severity?: TagSeverity;
};
}