Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ models/*
!models/api-validation-error.ts
!models/authorization-body-params.ts
!models/authorization-context-params.ts
!models/authorized-reponse.ts
!models/authorized-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ index.ts
models/api-validation-error.ts
models/authorization-body-params.ts
models/authorization-context-params.ts
models/authorized-reponse.ts
models/authorized-response.ts
runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ import * as runtime from '../runtime.js';
import type {
ApiValidationError,
AuthorizationBodyParams,
AuthorizedReponse,
AuthorizedResponse,
} from '../models/index.js';
import {
ApiValidationErrorFromJSON,
ApiValidationErrorToJSON,
AuthorizationBodyParamsFromJSON,
AuthorizationBodyParamsToJSON,
AuthorizedReponseFromJSON,
AuthorizedReponseToJSON,
AuthorizedResponseFromJSON,
AuthorizedResponseToJSON,
} from '../models/index.js';

export interface AuthorizationReferenceControllerAuthorizeByReferenceRequest {
Expand All @@ -47,12 +47,12 @@ export interface AuthorizationApiInterface {
* @throws {RequiredError}
* @memberof AuthorizationApiInterface
*/
authorizationReferenceControllerAuthorizeByReferenceRaw(requestParameters: AuthorizationReferenceControllerAuthorizeByReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthorizedReponse>>;
authorizationReferenceControllerAuthorizeByReferenceRaw(requestParameters: AuthorizationReferenceControllerAuthorizeByReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthorizedResponse>>;

/**
* Checks if user is authorized to perform the given operation.
*/
authorizationReferenceControllerAuthorizeByReference(requestParameters: AuthorizationReferenceControllerAuthorizeByReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthorizedReponse>;
authorizationReferenceControllerAuthorizeByReference(requestParameters: AuthorizationReferenceControllerAuthorizeByReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthorizedResponse>;

}

Expand All @@ -64,7 +64,7 @@ export class AuthorizationApi extends runtime.BaseAPI implements AuthorizationAp
/**
* Checks if user is authorized to perform the given operation.
*/
async authorizationReferenceControllerAuthorizeByReferenceRaw(requestParameters: AuthorizationReferenceControllerAuthorizeByReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthorizedReponse>> {
async authorizationReferenceControllerAuthorizeByReferenceRaw(requestParameters: AuthorizationReferenceControllerAuthorizeByReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthorizedResponse>> {
if (requestParameters['authorizationBodyParams'] == null) {
throw new runtime.RequiredError(
'authorizationBodyParams',
Expand Down Expand Up @@ -94,13 +94,13 @@ export class AuthorizationApi extends runtime.BaseAPI implements AuthorizationAp
body: AuthorizationBodyParamsToJSON(requestParameters['authorizationBodyParams']),
}, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => AuthorizedReponseFromJSON(jsonValue));
return new runtime.JSONApiResponse(response, (jsonValue) => AuthorizedResponseFromJSON(jsonValue));
}

/**
* Checks if user is authorized to perform the given operation.
*/
async authorizationReferenceControllerAuthorizeByReference(requestParameters: AuthorizationReferenceControllerAuthorizeByReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthorizedReponse> {
async authorizationReferenceControllerAuthorizeByReference(requestParameters: AuthorizationReferenceControllerAuthorizeByReferenceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthorizedResponse> {
const response = await this.authorizationReferenceControllerAuthorizeByReferenceRaw(requestParameters, initOverrides);
return await response.value();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,17 @@ export const AuthorizationContextParamsRequiredPermissions = {
ADMIN_EDIT: 'ADMIN_EDIT',
ADMIN_VIEW: 'ADMIN_VIEW',
BASE_VIEW: 'BASE_VIEW',
BOARD_VIEW: 'BOARD_VIEW',
BOARD_EDIT: 'BOARD_EDIT',
BOARD_SHARE_BOARD: 'BOARD_SHARE_BOARD',
BOARD_MANAGE_VIDEOCONFERENCE: 'BOARD_MANAGE_VIDEOCONFERENCE',
BOARD_MANAGE_READERS_CAN_EDIT: 'BOARD_MANAGE_READERS_CAN_EDIT',
BOARD_MANAGE: 'BOARD_MANAGE',
BOARD_RELOCATE_CONTENT: 'BOARD_RELOCATE_CONTENT',
CALENDAR_CREATE: 'CALENDAR_CREATE',
CALENDAR_EDIT: 'CALENDAR_EDIT',
CALENDAR_VIEW: 'CALENDAR_VIEW',
CAN_EXECUTE_INSTANCE_OPERATIONS: 'CAN_EXECUTE_INSTANCE_OPERATIONS',
CHANGE_TEAM_ROLES: 'CHANGE_TEAM_ROLES',
CLASS_CREATE: 'CLASS_CREATE',
CLASS_EDIT: 'CLASS_EDIT',
Expand Down Expand Up @@ -118,14 +126,17 @@ export const AuthorizationContextParamsRequiredPermissions = {
IMPORT_USER_UPDATE: 'IMPORT_USER_UPDATE',
IMPORT_USER_VIEW: 'IMPORT_USER_VIEW',
INSTANCE_VIEW: 'INSTANCE_VIEW',
INSTANCE_EDIT: 'INSTANCE_EDIT',
INVITE_ADMINISTRATORS: 'INVITE_ADMINISTRATORS',
INVITE_EXPERTS: 'INVITE_EXPERTS',
INVITE_EXTERNAL_PERSONS: 'INVITE_EXTERNAL_PERSONS',
JOIN_MEETING: 'JOIN_MEETING',
LEAVE_TEAM: 'LEAVE_TEAM',
LERNSTORE_VIEW: 'LERNSTORE_VIEW',
LESSONS_CREATE: 'LESSONS_CREATE',
LESSONS_VIEW: 'LESSONS_VIEW',
LINK_CREATE: 'LINK_CREATE',
MEDIA_SCHOOL_LICENSE_ADMIN: 'MEDIA_SCHOOL_LICENSE_ADMIN',
MEDIA_SOURCE_ADMIN: 'MEDIA_SOURCE_ADMIN',
NEWS_CREATE: 'NEWS_CREATE',
NEWS_EDIT: 'NEWS_EDIT',
NEWS_VIEW: 'NEWS_VIEW',
Expand All @@ -148,10 +159,24 @@ export const AuthorizationContextParamsRequiredPermissions = {
ROLE_CREATE: 'ROLE_CREATE',
ROLE_EDIT: 'ROLE_EDIT',
ROLE_VIEW: 'ROLE_VIEW',
ROOM_EDIT_CONTENT: 'ROOM_EDIT_CONTENT',
ROOM_EDIT_ROOM: 'ROOM_EDIT_ROOM',
ROOM_LIST_CONTENT: 'ROOM_LIST_CONTENT',
ROOM_DELETE_ROOM: 'ROOM_DELETE_ROOM',
ROOM_LEAVE_ROOM: 'ROOM_LEAVE_ROOM',
ROOM_COPY_ROOM: 'ROOM_COPY_ROOM',
ROOM_SHARE_ROOM: 'ROOM_SHARE_ROOM',
ROOM_ADD_MEMBERS: 'ROOM_ADD_MEMBERS',
ROOM_REMOVE_MEMBERS: 'ROOM_REMOVE_MEMBERS',
ROOM_CHANGE_ROLES: 'ROOM_CHANGE_ROLES',
ROOM_CHANGE_OWNER: 'ROOM_CHANGE_OWNER',
ROOM_MANAGE_INVITATIONLINKS: 'ROOM_MANAGE_INVITATIONLINKS',
ROOM_LIST_DRAFTS: 'ROOM_LIST_DRAFTS',
ROOM_MANAGE_VIDEOCONFERENCES: 'ROOM_MANAGE_VIDEOCONFERENCES',
SCHOOL_ADMINISTRATE_ROOMS: 'SCHOOL_ADMINISTRATE_ROOMS',
SCHOOL_CHAT_MANAGE: 'SCHOOL_CHAT_MANAGE',
SCHOOL_CREATE: 'SCHOOL_CREATE',
SCHOOL_EDIT: 'SCHOOL_EDIT',
SCHOOL_EDIT_ALL: 'SCHOOL_EDIT_ALL',
SCHOOL_LOGO_MANAGE: 'SCHOOL_LOGO_MANAGE',
SCHOOL_NEWS_EDIT: 'SCHOOL_NEWS_EDIT',
SCHOOL_PERMISSION_CHANGE: 'SCHOOL_PERMISSION_CHANGE',
Expand All @@ -160,6 +185,14 @@ export const AuthorizationContextParamsRequiredPermissions = {
SCHOOL_SYSTEM_EDIT: 'SCHOOL_SYSTEM_EDIT',
SCHOOL_SYSTEM_VIEW: 'SCHOOL_SYSTEM_VIEW',
SCHOOL_TOOL_ADMIN: 'SCHOOL_TOOL_ADMIN',
SCHOOL_VIEW: 'SCHOOL_VIEW',
SCHOOL_BECOME_ROOMOWNER: 'SCHOOL_BECOME_ROOMOWNER',
SCHOOL_CREATE_ROOM: 'SCHOOL_CREATE_ROOM',
SCHOOL_EDIT_ROOM: 'SCHOOL_EDIT_ROOM',
SCHOOL_DELETE_ROOM: 'SCHOOL_DELETE_ROOM',
SCHOOL_LIST_DISCOVERABLE_TEACHERS: 'SCHOOL_LIST_DISCOVERABLE_TEACHERS',
SCHOOL_LIST_ROOM_MEMBERS: 'SCHOOL_LIST_ROOM_MEMBERS',
SCHOOL_MANAGE_ROOM_INVITATIONLINKS: 'SCHOOL_MANAGE_ROOM_INVITATIONLINKS',
SCOPE_PERMISSIONS_VIEW: 'SCOPE_PERMISSIONS_VIEW',
START_MEETING: 'START_MEETING',
STUDENT_CREATE: 'STUDENT_CREATE',
Expand Down Expand Up @@ -196,7 +229,6 @@ export const AuthorizationContextParamsRequiredPermissions = {
TOPIC_EDIT: 'TOPIC_EDIT',
TOPIC_VIEW: 'TOPIC_VIEW',
UPLOAD_FILES: 'UPLOAD_FILES',
USE_LIBREOFFICE: 'USE_LIBREOFFICE',
USE_ROCKETCHAT: 'USE_ROCKETCHAT',
USERGROUP_CREATE: 'USERGROUP_CREATE',
USERGROUP_EDIT: 'USERGROUP_EDIT',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,37 @@ import { mapValues } from '../runtime.js';
/**
*
* @export
* @interface AuthorizedReponse
* @interface AuthorizedResponse
*/
export interface AuthorizedReponse {
export interface AuthorizedResponse {
/**
*
* @type {string}
* @memberof AuthorizedReponse
* @memberof AuthorizedResponse
*/
userId: string;
/**
*
* @type {boolean}
* @memberof AuthorizedReponse
* @memberof AuthorizedResponse
*/
isAuthorized: boolean;
}

/**
* Check if a given object implements the AuthorizedReponse interface.
* Check if a given object implements the AuthorizedResponse interface.
*/
export function instanceOfAuthorizedReponse(value: object): value is AuthorizedReponse {
export function instanceOfAuthorizedResponse(value: object): value is AuthorizedResponse {
if (!('userId' in value) || value['userId'] === undefined) return false;
if (!('isAuthorized' in value) || value['isAuthorized'] === undefined) return false;
return true;
}

export function AuthorizedReponseFromJSON(json: any): AuthorizedReponse {
return AuthorizedReponseFromJSONTyped(json, false);
export function AuthorizedResponseFromJSON(json: any): AuthorizedResponse {
return AuthorizedResponseFromJSONTyped(json, false);
}

export function AuthorizedReponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): AuthorizedReponse {
export function AuthorizedResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): AuthorizedResponse {
if (json == null) {
return json;
}
Expand All @@ -57,11 +57,11 @@ export function AuthorizedReponseFromJSONTyped(json: any, ignoreDiscriminator: b
};
}

export function AuthorizedReponseToJSON(json: any): AuthorizedReponse {
return AuthorizedReponseToJSONTyped(json, false);
export function AuthorizedResponseToJSON(json: any): AuthorizedResponse {
return AuthorizedResponseToJSONTyped(json, false);
}

export function AuthorizedReponseToJSONTyped(value?: AuthorizedReponse | null, ignoreDiscriminator: boolean = false): any {
export function AuthorizedResponseToJSONTyped(value?: AuthorizedResponse | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
export * from './api-validation-error.js';
export * from './authorization-body-params.js';
export * from './authorization-context-params.js';
export * from './authorized-reponse.js';
export * from './authorized-response.js';
6 changes: 3 additions & 3 deletions src/infra/authorization/authorization.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Test, TestingModule } from '@nestjs/testing';
import { HttpRequest } from 'uWebSockets.js';
import { WebSocketCloseCode } from '../../shared/type/websocket-close-code.js';
import { Logger } from '../logger/index.js';
import { AuthorizationApi, AuthorizedReponse } from './authorization-api-client/index.js';
import { AuthorizationApi, AuthorizedResponse } from './authorization-api-client/index.js';
import { AuthorizationService } from './authorization.service.js';

describe(AuthorizationService.name, () => {
Expand Down Expand Up @@ -51,7 +51,7 @@ describe(AuthorizationService.name, () => {
const setup = () => {
const { req } = setupRequest();

const response = createMock<AuthorizedReponse>({
const response = createMock<AuthorizedResponse>({
isAuthorized: true,
userId: '123',
});
Expand All @@ -75,7 +75,7 @@ describe(AuthorizationService.name, () => {
const setup = () => {
const { req } = setupRequest();

const response = createMock<AuthorizedReponse>({
const response = createMock<AuthorizedResponse>({
isAuthorized: false,
userId: '123',
});
Expand Down
Loading