Skip to content

Commit fbdcff4

Browse files
robot-ci-heartexfern-api[bot]hakan458
authored
feat: UTC-285: Add OrganizationPermission model + API (#602)
Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Co-authored-by: hakan458 <hakan@heartex.com>
1 parent ea9b1ed commit fbdcff4

19 files changed

Lines changed: 2691 additions & 64 deletions

.mock/definition/__package__.yml

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,6 +1620,23 @@ types:
16201620
docs: Last updated time
16211621
source:
16221622
openapi: openapi/openapi.yaml
1623+
ConfigurablePermissionOptionDefault:
1624+
discriminated: false
1625+
union:
1626+
- Role9E7Enum
1627+
- NullEnum
1628+
source:
1629+
openapi: openapi/openapi.yaml
1630+
inline: true
1631+
ConfigurablePermissionOption:
1632+
properties:
1633+
default: optional<ConfigurablePermissionOptionDefault>
1634+
label: optional<string>
1635+
options: list<Role9E7Enum>
1636+
permission: string
1637+
tooltip: optional<string>
1638+
source:
1639+
openapi: openapi/openapi.yaml
16231640
ConvertedFormat:
16241641
properties:
16251642
export_type:
@@ -2160,7 +2177,7 @@ types:
21602177
occurs, contact the LEAP team for assistance with enabling custom
21612178
scripts.
21622179
default_role:
2163-
type: optional<DefaultRoleEnum>
2180+
type: optional<Role9E7Enum>
21642181
docs: |-
21652182
Default membership role for invited users
21662183
@@ -2194,25 +2211,6 @@ types:
21942211
quick view.
21952212
source:
21962213
openapi: openapi/openapi.yaml
2197-
DefaultRoleEnum:
2198-
enum:
2199-
- OW
2200-
- AD
2201-
- MA
2202-
- RE
2203-
- AN
2204-
- DI
2205-
- 'NO'
2206-
docs: |-
2207-
* `OW` - Owner
2208-
* `AD` - Administrator
2209-
* `MA` - Manager
2210-
* `RE` - Reviewer
2211-
* `AN` - Annotator
2212-
* `DI` - Deactivated
2213-
* `NO` - Not Activated
2214-
source:
2215-
openapi: openapi/openapi.yaml
22162214
EditionEnum:
22172215
enum:
22182216
- Community
@@ -3604,7 +3602,7 @@ types:
36043602
* `MA` - Manager
36053603
custom_scripts_enabled: string
36063604
default_role:
3607-
type: optional<DefaultRoleEnum>
3605+
type: optional<Role9E7Enum>
36083606
docs: |-
36093607
Default membership role for invited users
36103608
@@ -5698,6 +5696,35 @@ types:
56985696
minLength: 1
56995697
source:
57005698
openapi: openapi/openapi.yaml
5699+
OrganizationPermission:
5700+
properties:
5701+
default_role: string
5702+
id: integer
5703+
label: string
5704+
options: string
5705+
organization: integer
5706+
permission:
5707+
type: string
5708+
validation:
5709+
maxLength: 255
5710+
roles:
5711+
type: optional<list<Role9E7Enum>>
5712+
docs: Explicit roles that have this permission within the organization.
5713+
tooltip: string
5714+
source:
5715+
openapi: openapi/openapi.yaml
5716+
OrganizationPermissionRequest:
5717+
properties:
5718+
permission:
5719+
type: string
5720+
validation:
5721+
minLength: 1
5722+
maxLength: 255
5723+
roles:
5724+
type: optional<list<Role9E7Enum>>
5725+
docs: Explicit roles that have this permission within the organization.
5726+
source:
5727+
openapi: openapi/openapi.yaml
57015728
PaginatedAllRolesProjectListList:
57025729
properties:
57035730
count: integer

.mock/definition/organizations.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ service:
200200
will be raised. If this occurs, contact the LEAP team for
201201
assistance with enabling custom scripts.
202202
default_role:
203-
type: optional<root.DefaultRoleEnum>
203+
type: optional<root.Role9E7Enum>
204204
docs: |-
205205
Default membership role for invited users
206206
Lines changed: 267 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,267 @@
1+
imports:
2+
root: ../__package__.yml
3+
service:
4+
auth: false
5+
base-path: ''
6+
endpoints:
7+
list:
8+
path: /api/organizations/{id}/permissions
9+
method: GET
10+
auth: true
11+
docs: >-
12+
List all organization-level permission overrides for a given
13+
organization.
14+
source:
15+
openapi: openapi/openapi.yaml
16+
path-parameters:
17+
id: integer
18+
display-name: List organization permission overrides
19+
request:
20+
name: PermissionsListRequest
21+
query-parameters:
22+
ordering:
23+
type: optional<string>
24+
docs: Which field to use when ordering the results.
25+
response:
26+
docs: ''
27+
type: list<root.OrganizationPermission>
28+
examples:
29+
- path-parameters:
30+
id: 1
31+
response:
32+
body:
33+
- default_role: default_role
34+
id: 1
35+
label: label
36+
options: options
37+
organization: 1
38+
permission: permission
39+
roles:
40+
- OW
41+
tooltip: tooltip
42+
audiences:
43+
- public
44+
create:
45+
path: /api/organizations/{id}/permissions
46+
method: POST
47+
auth: true
48+
docs: >-
49+
Create a new organization-level permission override for a given
50+
organization.
51+
source:
52+
openapi: openapi/openapi.yaml
53+
path-parameters:
54+
id: integer
55+
display-name: Create organization permission override
56+
request:
57+
body: root.OrganizationPermissionRequest
58+
content-type: application/json
59+
response:
60+
docs: ''
61+
type: root.OrganizationPermission
62+
errors:
63+
- root.BadRequestError
64+
- root.ForbiddenError
65+
examples:
66+
- path-parameters:
67+
id: 1
68+
request:
69+
permission: permission
70+
response:
71+
body:
72+
default_role: default_role
73+
id: 1
74+
label: label
75+
options: options
76+
organization: 1
77+
permission: permission
78+
roles:
79+
- OW
80+
tooltip: tooltip
81+
audiences:
82+
- public
83+
get_options:
84+
path: /api/organizations/{id}/permissions/options
85+
method: GET
86+
auth: true
87+
docs: >-
88+
Retrieve the list of configurable permission options (label, tooltip,
89+
default role and allowed roles).
90+
source:
91+
openapi: openapi/openapi.yaml
92+
path-parameters:
93+
id: integer
94+
display-name: Get configurable permissions options
95+
request:
96+
name: PermissionsGetOptionsRequest
97+
query-parameters:
98+
ordering:
99+
type: optional<string>
100+
docs: Which field to use when ordering the results.
101+
response:
102+
docs: ''
103+
type: list<root.ConfigurablePermissionOption>
104+
examples:
105+
- path-parameters:
106+
id: 1
107+
response:
108+
body:
109+
- default: OW
110+
label: label
111+
options:
112+
- OW
113+
permission: permission
114+
tooltip: tooltip
115+
audiences:
116+
- public
117+
get:
118+
path: /api/organizations/{id}/permissions/{permission}
119+
method: GET
120+
auth: true
121+
source:
122+
openapi: openapi/openapi.yaml
123+
path-parameters:
124+
id: integer
125+
permission: string
126+
display-name: Retrieve organization permission override
127+
response:
128+
docs: ''
129+
type: root.OrganizationPermission
130+
errors:
131+
- root.ForbiddenError
132+
- root.NotFoundError
133+
examples:
134+
- path-parameters:
135+
id: 1
136+
permission: permission
137+
response:
138+
body:
139+
default_role: default_role
140+
id: 1
141+
label: label
142+
options: options
143+
organization: 1
144+
permission: permission
145+
roles:
146+
- OW
147+
tooltip: tooltip
148+
audiences:
149+
- public
150+
replace:
151+
path: /api/organizations/{id}/permissions/{permission}
152+
method: PUT
153+
auth: true
154+
docs: >-
155+
Replace the organization-level permission override for a given
156+
permission key.
157+
source:
158+
openapi: openapi/openapi.yaml
159+
path-parameters:
160+
id:
161+
type: integer
162+
docs: A unique integer value identifying this organization.
163+
permission:
164+
type: string
165+
docs: Permission key to update within the organization.
166+
display-name: Replace organization permission override
167+
request:
168+
body: root.OrganizationPermissionRequest
169+
content-type: application/json
170+
response:
171+
docs: ''
172+
type: root.OrganizationPermission
173+
errors:
174+
- root.BadRequestError
175+
- root.ForbiddenError
176+
- root.NotFoundError
177+
examples:
178+
- path-parameters:
179+
id: 1
180+
permission: permission
181+
request:
182+
permission: permission
183+
response:
184+
body:
185+
default_role: default_role
186+
id: 1
187+
label: label
188+
options: options
189+
organization: 1
190+
permission: permission
191+
roles:
192+
- OW
193+
tooltip: tooltip
194+
audiences:
195+
- public
196+
delete:
197+
path: /api/organizations/{id}/permissions/{permission}
198+
method: DELETE
199+
auth: true
200+
source:
201+
openapi: openapi/openapi.yaml
202+
path-parameters:
203+
id: integer
204+
permission: string
205+
display-name: Delete organization permission override
206+
errors:
207+
- root.ForbiddenError
208+
- root.NotFoundError
209+
examples:
210+
- path-parameters:
211+
id: 1
212+
permission: permission
213+
audiences:
214+
- public
215+
update:
216+
path: /api/organizations/{id}/permissions/{permission}
217+
method: PATCH
218+
auth: true
219+
docs: >-
220+
Partially update the organization-level permission override for a given
221+
permission key.
222+
source:
223+
openapi: openapi/openapi.yaml
224+
path-parameters:
225+
id: integer
226+
permission: string
227+
display-name: Update organization permission override
228+
request:
229+
name: PatchedOrganizationPermissionRequest
230+
body:
231+
properties:
232+
permission:
233+
type: optional<string>
234+
name: patchedOrganizationPermissionRequestPermission
235+
roles:
236+
type: optional<list<root.Role9E7Enum>>
237+
docs: >-
238+
Explicit roles that have this permission within the
239+
organization.
240+
content-type: application/json
241+
response:
242+
docs: ''
243+
type: root.OrganizationPermission
244+
errors:
245+
- root.BadRequestError
246+
- root.ForbiddenError
247+
- root.NotFoundError
248+
examples:
249+
- path-parameters:
250+
id: 1
251+
permission: permission
252+
request: {}
253+
response:
254+
body:
255+
default_role: default_role
256+
id: 1
257+
label: label
258+
options: options
259+
organization: 1
260+
permission: permission
261+
roles:
262+
- OW
263+
tooltip: tooltip
264+
audiences:
265+
- public
266+
source:
267+
openapi: openapi/openapi.yaml

0 commit comments

Comments
 (0)