mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
* Implemented Custom role and permissions * converted Permissions interface into a class * formatting fix
52 lines
1.8 KiB
TypeScript
52 lines
1.8 KiB
TypeScript
import { BaseResponse } from './baseResponse';
|
|
import { SelectionReadOnlyResponse } from './selectionReadOnlyResponse';
|
|
|
|
import { PermissionsApi } from '../api/permissionsApi';
|
|
|
|
import { OrganizationUserStatusType } from '../../enums/organizationUserStatusType';
|
|
import { OrganizationUserType } from '../../enums/organizationUserType';
|
|
|
|
export class OrganizationUserResponse extends BaseResponse {
|
|
id: string;
|
|
userId: string;
|
|
type: OrganizationUserType;
|
|
status: OrganizationUserStatusType;
|
|
accessAll: boolean;
|
|
permissions: PermissionsApi;
|
|
|
|
constructor(response: any) {
|
|
super(response);
|
|
this.id = this.getResponseProperty('Id');
|
|
this.userId = this.getResponseProperty('UserId');
|
|
this.type = this.getResponseProperty('Type');
|
|
this.status = this.getResponseProperty('Status');
|
|
this.permissions = new PermissionsApi(this.getResponseProperty('Permissions'));
|
|
this.accessAll = this.getResponseProperty('AccessAll');
|
|
}
|
|
}
|
|
|
|
export class OrganizationUserUserDetailsResponse extends OrganizationUserResponse {
|
|
name: string;
|
|
email: string;
|
|
twoFactorEnabled: boolean;
|
|
|
|
constructor(response: any) {
|
|
super(response);
|
|
this.name = this.getResponseProperty('Name');
|
|
this.email = this.getResponseProperty('Email');
|
|
this.twoFactorEnabled = this.getResponseProperty('TwoFactorEnabled');
|
|
}
|
|
}
|
|
|
|
export class OrganizationUserDetailsResponse extends OrganizationUserResponse {
|
|
collections: SelectionReadOnlyResponse[] = [];
|
|
|
|
constructor(response: any) {
|
|
super(response);
|
|
const collections = this.getResponseProperty('Collections');
|
|
if (collections != null) {
|
|
this.collections = collections.map((c: any) => new SelectionReadOnlyResponse(c));
|
|
}
|
|
}
|
|
}
|