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; }); } }