EchoTex_Payroll/HRM.UI/ClientApp/src/app/_models/Authentication/UserRole.ts
2024-10-14 10:01:49 +06:00

49 lines
1.1 KiB
TypeScript

import {BaseObject} from '../Basic/baseObject';
import {Role, RolePermission} from './role';
import {User} from './user';
import {EnumAuthStatus} from '../enums';
export class UserRole extends BaseObject {
constructor() {
super();
this.userID = 0;
}
roleID: number;
userID: number;
role: Role;
user: User;
rolePermision: RolePermission[];
authorizedDate: Date;
authorizedBy: number;
approvedComputerName: string;
computerName: string;
userRoleStatus: EnumAuthStatus;
loginIDView: string;
userNameView: string;
roleNameView: string;
roleNamesView: string;
payrollTypeID?: number;
employeeID?: number;
getRoleNames(users: User[], useRoles: UserRole[]) {
var useRole: UserRole[];
var str = '';
users.forEach(u => {
str = '';
var temproles: UserRole[] = useRoles.filter(x => u.id == x.userID);
if (temproles! = undefined) {
temproles.forEach(y => {
str = str + y.roleNameView;
});
}
u.roleNames = str;
});
}
}