@spinajs/authz-http-admin 0.0.0-stage → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/README.md +52 -2
  2. package/lib/cjs/config/authz-http-admin.d.ts +9 -0
  3. package/lib/cjs/config/authz-http-admin.d.ts.map +1 -0
  4. package/lib/cjs/config/authz-http-admin.js +16 -0
  5. package/lib/cjs/config/authz-http-admin.js.map +1 -0
  6. package/lib/cjs/controllers/AuthzAdminController.d.ts +249 -0
  7. package/lib/cjs/controllers/AuthzAdminController.d.ts.map +1 -0
  8. package/lib/cjs/controllers/AuthzAdminController.js +549 -0
  9. package/lib/cjs/controllers/AuthzAdminController.js.map +1 -0
  10. package/lib/cjs/index.d.ts +4 -0
  11. package/lib/cjs/index.d.ts.map +1 -0
  12. package/lib/cjs/index.js +20 -0
  13. package/lib/cjs/index.js.map +1 -0
  14. package/lib/cjs/package.json +1 -0
  15. package/lib/cjs/routes/decode.d.ts +11 -0
  16. package/lib/cjs/routes/decode.d.ts.map +1 -0
  17. package/lib/cjs/routes/decode.js +53 -0
  18. package/lib/cjs/routes/decode.js.map +1 -0
  19. package/lib/cjs/routes/index.d.ts +4 -0
  20. package/lib/cjs/routes/index.d.ts.map +1 -0
  21. package/lib/cjs/routes/index.js +20 -0
  22. package/lib/cjs/routes/index.js.map +1 -0
  23. package/lib/cjs/routes/query.d.ts +16 -0
  24. package/lib/cjs/routes/query.d.ts.map +1 -0
  25. package/lib/cjs/routes/query.js +128 -0
  26. package/lib/cjs/routes/query.js.map +1 -0
  27. package/lib/cjs/routes/status.d.ts +6 -0
  28. package/lib/cjs/routes/status.d.ts.map +1 -0
  29. package/lib/cjs/routes/status.js +21 -0
  30. package/lib/cjs/routes/status.js.map +1 -0
  31. package/lib/cjs/schemas/bodies.d.ts +16 -0
  32. package/lib/cjs/schemas/bodies.d.ts.map +1 -0
  33. package/lib/cjs/schemas/bodies.js +39 -0
  34. package/lib/cjs/schemas/bodies.js.map +1 -0
  35. package/lib/cjs/schemas/commands.d.ts +9 -0
  36. package/lib/cjs/schemas/commands.d.ts.map +1 -0
  37. package/lib/cjs/schemas/commands.js +64 -0
  38. package/lib/cjs/schemas/commands.js.map +1 -0
  39. package/lib/cjs/schemas/document.d.ts +19 -0
  40. package/lib/cjs/schemas/document.d.ts.map +1 -0
  41. package/lib/cjs/schemas/document.js +76 -0
  42. package/lib/cjs/schemas/document.js.map +1 -0
  43. package/lib/cjs/schemas/index.d.ts +6 -0
  44. package/lib/cjs/schemas/index.d.ts.map +1 -0
  45. package/lib/cjs/schemas/index.js +21 -0
  46. package/lib/cjs/schemas/index.js.map +1 -0
  47. package/lib/cjs/schemas/primitives.d.ts +13 -0
  48. package/lib/cjs/schemas/primitives.d.ts.map +1 -0
  49. package/lib/cjs/schemas/primitives.js +29 -0
  50. package/lib/cjs/schemas/primitives.js.map +1 -0
  51. package/lib/cjs/schemas/provider.d.ts +13 -0
  52. package/lib/cjs/schemas/provider.d.ts.map +1 -0
  53. package/lib/cjs/schemas/provider.js +62 -0
  54. package/lib/cjs/schemas/provider.js.map +1 -0
  55. package/lib/mjs/config/authz-http-admin.d.ts +9 -0
  56. package/lib/mjs/config/authz-http-admin.d.ts.map +1 -0
  57. package/lib/mjs/config/authz-http-admin.js +14 -0
  58. package/lib/mjs/config/authz-http-admin.js.map +1 -0
  59. package/lib/mjs/controllers/AuthzAdminController.d.ts +249 -0
  60. package/lib/mjs/controllers/AuthzAdminController.d.ts.map +1 -0
  61. package/lib/mjs/controllers/AuthzAdminController.js +546 -0
  62. package/lib/mjs/controllers/AuthzAdminController.js.map +1 -0
  63. package/lib/mjs/index.d.ts +4 -0
  64. package/lib/mjs/index.d.ts.map +1 -0
  65. package/lib/mjs/index.js +4 -0
  66. package/lib/mjs/index.js.map +1 -0
  67. package/lib/mjs/package.json +1 -0
  68. package/lib/mjs/routes/decode.d.ts +11 -0
  69. package/lib/mjs/routes/decode.d.ts.map +1 -0
  70. package/lib/mjs/routes/decode.js +48 -0
  71. package/lib/mjs/routes/decode.js.map +1 -0
  72. package/lib/mjs/routes/index.d.ts +4 -0
  73. package/lib/mjs/routes/index.d.ts.map +1 -0
  74. package/lib/mjs/routes/index.js +4 -0
  75. package/lib/mjs/routes/index.js.map +1 -0
  76. package/lib/mjs/routes/query.d.ts +16 -0
  77. package/lib/mjs/routes/query.d.ts.map +1 -0
  78. package/lib/mjs/routes/query.js +120 -0
  79. package/lib/mjs/routes/query.js.map +1 -0
  80. package/lib/mjs/routes/status.d.ts +6 -0
  81. package/lib/mjs/routes/status.d.ts.map +1 -0
  82. package/lib/mjs/routes/status.js +17 -0
  83. package/lib/mjs/routes/status.js.map +1 -0
  84. package/lib/mjs/schemas/bodies.d.ts +16 -0
  85. package/lib/mjs/schemas/bodies.d.ts.map +1 -0
  86. package/lib/mjs/schemas/bodies.js +36 -0
  87. package/lib/mjs/schemas/bodies.js.map +1 -0
  88. package/lib/mjs/schemas/commands.d.ts +9 -0
  89. package/lib/mjs/schemas/commands.d.ts.map +1 -0
  90. package/lib/mjs/schemas/commands.js +61 -0
  91. package/lib/mjs/schemas/commands.js.map +1 -0
  92. package/lib/mjs/schemas/document.d.ts +19 -0
  93. package/lib/mjs/schemas/document.d.ts.map +1 -0
  94. package/lib/mjs/schemas/document.js +72 -0
  95. package/lib/mjs/schemas/document.js.map +1 -0
  96. package/lib/mjs/schemas/index.d.ts +6 -0
  97. package/lib/mjs/schemas/index.d.ts.map +1 -0
  98. package/lib/mjs/schemas/index.js +5 -0
  99. package/lib/mjs/schemas/index.js.map +1 -0
  100. package/lib/mjs/schemas/primitives.d.ts +13 -0
  101. package/lib/mjs/schemas/primitives.d.ts.map +1 -0
  102. package/lib/mjs/schemas/primitives.js +24 -0
  103. package/lib/mjs/schemas/primitives.js.map +1 -0
  104. package/lib/mjs/schemas/provider.d.ts +13 -0
  105. package/lib/mjs/schemas/provider.d.ts.map +1 -0
  106. package/lib/mjs/schemas/provider.js +26 -0
  107. package/lib/mjs/schemas/provider.js.map +1 -0
  108. package/lib/tsconfig.cjs.tsbuildinfo +1 -0
  109. package/lib/tsconfig.mjs.tsbuildinfo +1 -0
  110. package/package.json +67 -4
package/README.md CHANGED
@@ -1,3 +1,53 @@
1
- # Temporary Holding Version
1
+ # `@spinajs/authz-http-admin`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Admin routes over the SpinaJS authorization management API (`AuthzAdmin`,
4
+ design §6.6.5).
5
+
6
+ ## Routes
7
+
8
+ | Route | Runs |
9
+ |---|---|
10
+ | `POST /authz/commands` `{ commands, reason?, idempotencyKey?, dryRun? }` | `execute` |
11
+ | `GET /authz/assignments?scope=&subject=&role=&includeExpired=&limit=&offset=` | `list({ kind: 'assignments' })` |
12
+ | `POST /authz/assignments`, `PATCH`/`DELETE /authz/assignments/:id` | `assignment.*` |
13
+ | `GET`/`POST /authz/links`, `PATCH`/`DELETE /authz/links/:id` | `link.*` |
14
+ | `GET /authz/rules`, `PUT`/`DELETE /authz/rules/:id` | `rule.*` |
15
+ | `GET /authz/holders?scope=&permission=&expandSets=&limit=&offset=` | `list({ kind: 'holders' })` |
16
+ | `GET /authz/policies`, `PUT`/`DELETE /authz/policies/:id` | `policy.*` |
17
+ | `GET`/`PATCH`/`PUT /authz/scopes/:type/:id/attributes` | `scope.*` |
18
+
19
+ - The routes check only that the caller is authenticated (401 otherwise).
20
+ The caller's principal is the actor; every permission, validation and
21
+ guard check runs inside `AuthzAdmin`, so an HTTP call and an in-process
22
+ call get the same answer.
23
+ - Query encodings: `scope` is `<type>` or `<type>:<id>`; `subject` is
24
+ `<type>:<id>` or `set:<role>@<type>:<id>`. On the single-command routes
25
+ `reason`, `idempotencyKey` and `dryRun` go in the query string.
26
+ - Writes answer `{ results }`; a failed command sets the status (403 for
27
+ `forbidden`, `escalation`, `last_holder`, `self_lockout`,
28
+ `protected_role`; 404 `not_found`; 409 `conflict`; 400 otherwise).
29
+ Lists answer `{ items, total }`.
30
+ - `GET /authz/holders` lists who holds `permission` on `scope` (both
31
+ required; `expandSets=true` also lists set members). It answers `{ items,
32
+ total }`, or 400 `invalid_query` for a missing or unknown value, 401, and
33
+ 403 `forbidden` (the caller needs `authz:holders.read` at the resource).
34
+ See [Holders](../../docs/authz/13-holders.md).
35
+ - A link token is shown once: only in the answer of `POST /authz/links` or
36
+ of the `POST /authz/commands` batch that created it. Both routes send
37
+ `Cache-Control: no-store`.
38
+
39
+ ## Configuration
40
+
41
+ - `authz.http.admin.domain` (default `root`): the authz domain whose
42
+ `AuthzAdmin` the routes use.
43
+ - The package ships no `AdminGuard`; `AuthzAdmin` runs the one named in
44
+ `authz.admin.guard.service` (`DefaultAdminGuard` from
45
+ `@spinajs/authz-rbac`).
46
+
47
+ ## Swagger
48
+
49
+ http-swagger documents the routes and their answers. It cannot see the
50
+ request bodies and query parameters, because the routes read them from the
51
+ request so that no http-layer check can refuse what `AuthzAdmin` would
52
+ answer. Pass the built document through `describeAuthzAdminDocument(doc)` to
53
+ add them.
@@ -0,0 +1,9 @@
1
+ declare const authzHttpAdmin: {
2
+ system: {
3
+ dirs: {
4
+ controllers: string[];
5
+ };
6
+ };
7
+ };
8
+ export default authzHttpAdmin;
9
+ //# sourceMappingURL=authz-http-admin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authz-http-admin.d.ts","sourceRoot":"","sources":["../../../src/config/authz-http-admin.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,cAAc;IAClB,MAAM;QACJ,IAAI;YACF,WAAW;;;CAGhB,CAAC;eAEa,cAAc"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const path_1 = require("path");
4
+ function dir(path) {
5
+ const inCommonJs = typeof module !== 'undefined';
6
+ return (0, path_1.resolve)((0, path_1.normalize)((0, path_1.join)(process.env.WORKSPACE_ROOT_PATH ?? process.cwd(), 'node_modules', '@spinajs', 'authz-http-admin', 'lib', inCommonJs ? 'cjs' : 'mjs', path)));
7
+ }
8
+ const authzHttpAdmin = {
9
+ system: {
10
+ dirs: {
11
+ controllers: [dir('controllers')],
12
+ },
13
+ },
14
+ };
15
+ exports.default = authzHttpAdmin;
16
+ //# sourceMappingURL=authz-http-admin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authz-http-admin.js","sourceRoot":"","sources":["../../../src/config/authz-http-admin.ts"],"names":[],"mappings":";;AAAA,+BAAgD;AAEhD,SAAS,GAAG,CAAC,IAAY;IACvB,MAAM,UAAU,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC;IACjD,OAAO,IAAA,cAAO,EAAC,IAAA,gBAAS,EAAC,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE,kBAAkB,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AAC7K,CAAC;AAED,MAAM,cAAc,GAAG;IACrB,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,WAAW,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;SAClC;KACF;CACF,CAAC;kBAEa,cAAc"}
@@ -0,0 +1,249 @@
1
+ import { AuthzDomains } from '@spinajs/authz';
2
+ import type { AuthzAdmin, AuthzAdminQuery, AuthzCommand } from '@spinajs/authz';
3
+ import { BaseController } from '@spinajs/http';
4
+ import type { Request, Response } from '@spinajs/http';
5
+ import '../schemas/provider.js';
6
+ /**
7
+ * Admin routes over the management API of the configured domain (`authz.http.admin.domain`).
8
+ *
9
+ * The routes check authentication only: the actor is always the request principal, and every
10
+ * permission, validation and guard check runs in AuthzAdmin, as for an in-process caller (design
11
+ * §6.6.5). A refused request answers `{ error: { code, message, field? } }`; a write answers
12
+ * `{ results }`, one entry per command.
13
+ *
14
+ * @tags Authz admin
15
+ */
16
+ export declare class AuthzAdminController extends BaseController {
17
+ protected AdminDomain: string;
18
+ protected Domains: AuthzDomains;
19
+ /** Runs a route on the domain's AuthzAdmin; an AuthzAdminFailure becomes its status with `{ error }`, anything else propagates. */
20
+ protected guarded(fn: (admin: AuthzAdmin) => Promise<Response>): Promise<Response>;
21
+ /** One batch built from the route, with the options of the query string. */
22
+ protected single(req: Request, build: () => AuthzCommand[]): Promise<Response<any>>;
23
+ protected list(req: Request, build: () => AuthzAdminQuery): Promise<Response<any>>;
24
+ /**
25
+ * Run a batch of commands
26
+ * Runs the commands in order in one transaction on the configured domain; the first failure rolls the batch back and its status is the answer.
27
+ * Body: { commands, reason?, idempotencyKey?, dryRun? } (schema AuthzAdminBatch); `commands` lists the command kinds of AuthzCommand, with dates as ISO 8601 strings. The options go in the body, not the query string.
28
+ * The result of a link.create carries the link token, shown once: every answer the route sends carries `Cache-Control: no-store` (the 401 of the authentication check comes before the route and holds no token), and a retried or dry-run batch answers without the token.
29
+ * @response 200 {AuthzAdminResults} Every command succeeded
30
+ * @response 400 {AuthzAdminError} invalid_request, invalid_batch or a validation code of the command
31
+ * @response 401 Unauthorized: a valid session or token is required
32
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
33
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
34
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
35
+ */
36
+ commands(req: Request): Promise<Response<any>>;
37
+ /**
38
+ * List assignments
39
+ * Lists assignments, filtered by the query.
40
+ * Query: `scope` (`<type>` or `<type>:<id>`), `subject` (`<type>:<id>` or `set:<role>@<type>:<id>`), `role`, `includeExpired` (`true` or `false`), `limit`, `offset`.
41
+ * @response 200 {AuthzAdminPage} One page of rows
42
+ * @response 400 {AuthzAdminError} invalid_query: a malformed query parameter
43
+ * @response 401 Unauthorized: a valid session or token is required
44
+ * @response 403 {AuthzAdminError} forbidden: the caller lacks the read permission at the scope
45
+ */
46
+ listAssignments(req: Request): Promise<Response<any>>;
47
+ /**
48
+ * List holders
49
+ * Who holds a permission on a resource through role assignments on it, its ancestors or $global; each principal is verified by a fresh check.
50
+ * Query: `scope` (`<type>:<id>`), `permission`, `expandSets` (`true` or `false`), `limit`, `offset`.
51
+ * @response 200 {AuthzAdminPage} One page of holders
52
+ * @response 400 {AuthzAdminError} invalid_query: a malformed or missing query parameter
53
+ * @response 401 Unauthorized: a valid session or token is required
54
+ * @response 403 {AuthzAdminError} forbidden: the caller lacks authz:holders.read at the resource, or the resource is unknown
55
+ */
56
+ listHolders(req: Request): Promise<Response<any>>;
57
+ /**
58
+ * Grant a role
59
+ * Grants a role to a subject at a scope (assignment.grant).
60
+ * Body: the fields of assignment.grant without `kind` (schema AuthzAssignmentGrant).
61
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
62
+ * @response 200 {AuthzAdminResults} Every command succeeded
63
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
64
+ * @response 401 Unauthorized: a valid session or token is required
65
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
66
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
67
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
68
+ */
69
+ grant(req: Request): Promise<Response<any>>;
70
+ /**
71
+ * Change an assignment
72
+ * Changes the tags or the expiry of an assignment.
73
+ * Body: { tags?, addTags?, removeTags?, expiresAt? } with at least one key (schema AuthzAssignmentPatch); the keys run as one batch.
74
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
75
+ * @response 200 {AuthzAdminResults} Every command succeeded
76
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
77
+ * @response 401 Unauthorized: a valid session or token is required
78
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
79
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
80
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
81
+ */
82
+ patchAssignment(req: Request): Promise<Response<any>>;
83
+ /**
84
+ * Revoke an assignment
85
+ * Revokes the assignment with the path id.
86
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
87
+ * @response 200 {AuthzAdminResults} Every command succeeded
88
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
89
+ * @response 401 Unauthorized: a valid session or token is required
90
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
91
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
92
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
93
+ */
94
+ revoke(req: Request): Promise<Response<any>>;
95
+ /**
96
+ * List share links
97
+ * Lists the share links, filtered by the query. A listing never carries a token or its hash: the token is shown once, when the link is created.
98
+ * Query: `scope` (`<type>` or `<type>:<id>`), `limit`, `offset`.
99
+ * @response 200 {AuthzAdminPage} One page of rows
100
+ * @response 400 {AuthzAdminError} invalid_query: a malformed query parameter
101
+ * @response 401 Unauthorized: a valid session or token is required
102
+ * @response 403 {AuthzAdminError} forbidden: the caller lacks the read permission at the scope
103
+ */
104
+ listLinks(req: Request): Promise<Response<any>>;
105
+ /**
106
+ * Create a share link
107
+ * Creates a share link that grants a role at a scope (link.create). The result carries the link id and its token: the token is shown once, here, and every answer the route sends carries `Cache-Control: no-store` (the 401 of the authentication check comes before the route and holds no token). A dry run or a retried request (same idempotency key) answers without the token.
108
+ * Body: the fields of link.create without `kind` (schema AuthzLinkCreate).
109
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
110
+ * @response 200 {AuthzAdminResults} The link was created; results[0] holds its id and token
111
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
112
+ * @response 401 Unauthorized: a valid session or token is required
113
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
114
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
115
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
116
+ */
117
+ createLink(req: Request): Promise<Response<any>>;
118
+ /**
119
+ * Change a share link
120
+ * Changes the expiry, attributes, role or tags of the link with the path id (link.update). The answer never carries the token.
121
+ * Body: { expiresAt?, attributes?, role?, tags? } with at least one key (schema AuthzLinkPatch); an `id` in the body must equal the path id.
122
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
123
+ * @response 200 {AuthzAdminResults} Every command succeeded
124
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
125
+ * @response 401 Unauthorized: a valid session or token is required
126
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
127
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
128
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
129
+ */
130
+ patchLink(req: Request): Promise<Response<any>>;
131
+ /**
132
+ * Revoke a share link
133
+ * Revokes the link with the path id and the role it grants (link.revoke); its token opens nothing from then on.
134
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
135
+ * @response 200 {AuthzAdminResults} Every command succeeded
136
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
137
+ * @response 401 Unauthorized: a valid session or token is required
138
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
139
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
140
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
141
+ */
142
+ revokeLink(req: Request): Promise<Response<any>>;
143
+ /**
144
+ * List rules
145
+ * Lists the RBAC rules held as rows.
146
+ * Query: `scope` (`<type>` or `<type>:<id>`), `limit`, `offset`.
147
+ * @response 200 {AuthzAdminPage} One page of rows
148
+ * @response 400 {AuthzAdminError} invalid_query: a malformed query parameter
149
+ * @response 401 Unauthorized: a valid session or token is required
150
+ * @response 403 {AuthzAdminError} forbidden: the caller lacks the read permission at the scope
151
+ */
152
+ listRules(req: Request): Promise<Response<any>>;
153
+ /**
154
+ * Put a rule
155
+ * Inserts or replaces the RBAC rule with the path id.
156
+ * Body: a rule (schema AuthzRuleBody); an `id` in the body must equal the path id.
157
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
158
+ * @response 200 {AuthzAdminResults} Every command succeeded
159
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
160
+ * @response 401 Unauthorized: a valid session or token is required
161
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
162
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
163
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
164
+ */
165
+ putRule(req: Request): Promise<Response<any>>;
166
+ /**
167
+ * Delete a rule
168
+ * Deletes the RBAC rule with the path id.
169
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
170
+ * @response 200 {AuthzAdminResults} Every command succeeded
171
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
172
+ * @response 401 Unauthorized: a valid session or token is required
173
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
174
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
175
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
176
+ */
177
+ deleteRule(req: Request): Promise<Response<any>>;
178
+ /**
179
+ * List policies
180
+ * Lists the ABAC policies held as rows.
181
+ * Query: `scope` (`<type>` or `<type>:<id>`), `limit`, `offset`.
182
+ * @response 200 {AuthzAdminPage} One page of rows
183
+ * @response 400 {AuthzAdminError} invalid_query: a malformed query parameter
184
+ * @response 401 Unauthorized: a valid session or token is required
185
+ * @response 403 {AuthzAdminError} forbidden: the caller lacks the read permission at the scope
186
+ */
187
+ listPolicies(req: Request): Promise<Response<any>>;
188
+ /**
189
+ * Put a policy
190
+ * Inserts or replaces the ABAC policy with the path id.
191
+ * Body: a policy (schema AuthzPolicyBody); an `id` in the body must equal the path id.
192
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
193
+ * @response 200 {AuthzAdminResults} Every command succeeded
194
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
195
+ * @response 401 Unauthorized: a valid session or token is required
196
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
197
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
198
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
199
+ */
200
+ putPolicy(req: Request): Promise<Response<any>>;
201
+ /**
202
+ * Delete a policy
203
+ * Deletes the ABAC policy with the path id.
204
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
205
+ * @response 200 {AuthzAdminResults} Every command succeeded
206
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
207
+ * @response 401 Unauthorized: a valid session or token is required
208
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
209
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
210
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
211
+ */
212
+ deletePolicy(req: Request): Promise<Response<any>>;
213
+ /**
214
+ * Read scope attributes
215
+ * Returns the attributes of the scope node `<type>:<id>`.
216
+ * @response 200 {AuthzAdminPage} items holds one entry, the attributes object of the scope; total is 1
217
+ * @response 400 {AuthzAdminError} invalid_query: a malformed query parameter
218
+ * @response 401 Unauthorized: a valid session or token is required
219
+ * @response 403 {AuthzAdminError} forbidden: the caller lacks the read permission at the scope
220
+ */
221
+ attributes(req: Request): Promise<Response<any>>;
222
+ /**
223
+ * Merge scope attributes
224
+ * Deep-merges the body into the attributes of the scope node; null deletes a path.
225
+ * Body: an object (schema AuthzAttributesPatch).
226
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
227
+ * @response 200 {AuthzAdminResults} Every command succeeded
228
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
229
+ * @response 401 Unauthorized: a valid session or token is required
230
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
231
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
232
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
233
+ */
234
+ patchAttributes(req: Request): Promise<Response<any>>;
235
+ /**
236
+ * Replace scope attributes
237
+ * Replaces all attributes of the scope node with the body.
238
+ * Body: an object (schema AuthzAttributesBody).
239
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
240
+ * @response 200 {AuthzAdminResults} Every command succeeded
241
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
242
+ * @response 401 Unauthorized: a valid session or token is required
243
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
244
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
245
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
246
+ */
247
+ replaceAttributes(req: Request): Promise<Response<any>>;
248
+ }
249
+ //# sourceMappingURL=AuthzAdminController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthzAdminController.d.ts","sourceRoot":"","sources":["../../../src/controllers/AuthzAdminController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGjE,OAAO,KAAK,EAAE,UAAU,EAAqB,eAAe,EAAE,YAAY,EAA0B,MAAM,gBAAgB,CAAC;AAC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