85 lines
2.8 KiB
JavaScript
85 lines
2.8 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.PermissionService = void 0;
|
|
const request_1 = require("../core/request");
|
|
class PermissionService {
|
|
/**
|
|
* Get all
|
|
* Lists all permissions for all users and groups.
|
|
* @returns ResponsePermission
|
|
* @throws ApiError
|
|
*/
|
|
static async permissionControllerGetAll() {
|
|
const result = await (0, request_1.request)({
|
|
method: 'GET',
|
|
path: `/api/permissions`,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Post
|
|
* Create a new permission for a existing principal(user/group). <br> If a permission with this target, action and prinicpal already exists that permission will be returned instead of creating a new one.
|
|
* @param requestBody CreatePermission
|
|
* @returns ResponsePermission
|
|
* @throws ApiError
|
|
*/
|
|
static async permissionControllerPost(requestBody) {
|
|
const result = await (0, request_1.request)({
|
|
method: 'POST',
|
|
path: `/api/permissions`,
|
|
body: requestBody,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Get one
|
|
* Lists all information about the permission whose id got provided.
|
|
* @param id
|
|
* @returns ResponsePermission
|
|
* @throws ApiError
|
|
*/
|
|
static async permissionControllerGetOne(id) {
|
|
const result = await (0, request_1.request)({
|
|
method: 'GET',
|
|
path: `/api/permissions/${id}`,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Put
|
|
* Update a permission object. <br> If updateing the permission object would result in duplicate permission (same target, action and principal) this permission will get deleted and the existing permission will be returned. <br> Please remember that ids can't be changed.
|
|
* @param id
|
|
* @param requestBody UpdatePermission
|
|
* @returns ResponsePrincipal
|
|
* @throws ApiError
|
|
*/
|
|
static async permissionControllerPut(id, requestBody) {
|
|
const result = await (0, request_1.request)({
|
|
method: 'PUT',
|
|
path: `/api/permissions/${id}`,
|
|
body: requestBody,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Remove
|
|
* Deletes the permission whose id you provide. <br> If no permission with this id exists it will just return 204(no content).
|
|
* @param id
|
|
* @param force
|
|
* @returns ResponsePermission
|
|
* @returns ResponseEmpty
|
|
* @throws ApiError
|
|
*/
|
|
static async permissionControllerRemove(id, force) {
|
|
const result = await (0, request_1.request)({
|
|
method: 'DELETE',
|
|
path: `/api/permissions/${id}`,
|
|
query: {
|
|
'force': force,
|
|
},
|
|
});
|
|
return result.body;
|
|
}
|
|
}
|
|
exports.PermissionService = PermissionService;
|