User Role Permission
This commit is contained in:
parent
47657f6f75
commit
66a1a36698
|
|
@ -72,7 +72,9 @@ namespace HRM.DA
|
|||
}
|
||||
|
||||
return tc.ExecuteReader(
|
||||
@"SELECT ur.*, u.LOGINID LoginID, u.USERNAME UserName,R.Name RoleName, u.EmployeeID employeeID FROM UserRole ur,[Users] u, Role R
|
||||
@"SELECT ur.*, u.LOGINID LoginID, u.USERNAME UserName,R.Name RoleName, u.EmployeeID employeeID,
|
||||
(SELECT e.PayrollTypeID FROM Employee e WHERE e.EmployeeID = u.EmployeeID) EmpPayrollTypeID
|
||||
FROM UserRole ur,[Users] u, Role R
|
||||
WHERE ur.RoleID=r.RoleID and u.UserID =ur.UserID %q order by u.LoginID,R.Name", sqlClause);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ namespace HRM.DA
|
|||
oUserRole.ApprovedComputerName = oReader.GetString("ApprovedComputerName");
|
||||
oUserRole.UserRoleStatus = (EnumAuthStatus)oReader.GetInt32("Status").Value;
|
||||
oUserRole.employeeID = oReader.GetInt32("employeeID",true, 0) ==0? null: oReader.GetInt32("employeeID");
|
||||
// Only the list query (UserRoleDA.Get by role type) carries EmpPayrollTypeID: the employee's payroll type.
|
||||
int empPayrollTypeID = oReader.GetInt32("EmpPayrollTypeID", true, 0);
|
||||
oUserRole.payrollTypeID = empPayrollTypeID == 0 ? null : empPayrollTypeID;
|
||||
oUserRole.loginIDView = oReader.GetString("LoginID", true, string.Empty);
|
||||
oUserRole.userNameView = oReader.GetString("userName", true, string.Empty);
|
||||
oUserRole.roleNameView = oReader.GetString("roleName", true, string.Empty);
|
||||
|
|
|
|||
|
|
@ -73,6 +73,8 @@
|
|||
</ng-template>
|
||||
</kendo-grid-column>
|
||||
<kendo-grid-column field="userName" title="Name" [width]="220"></kendo-grid-column>
|
||||
<kendo-grid-column field="payrollTypeName" title="Payroll Type" [width]="180"
|
||||
[hidden]="listRoleType != roletypeEnum.Self_Service"></kendo-grid-column>
|
||||
<kendo-grid-column field="rolesText" title="Roles">
|
||||
<ng-template kendoGridCellTemplate let-dataItem>
|
||||
<div class="url-roles">
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@ interface AssignmentRow {
|
|||
employeeID: number;
|
||||
loginID: string;
|
||||
userName: string;
|
||||
/** Self Service only: the employee's payroll type. */
|
||||
payrollTypeID: number;
|
||||
payrollTypeName: string;
|
||||
roles: string[];
|
||||
rolesText: string;
|
||||
pending: boolean;
|
||||
|
|
@ -56,6 +59,8 @@ export class UserRoleListComponent implements OnInit {
|
|||
activeView: 'assignments' | 'pending' = 'assignments';
|
||||
listRoleType: EnumRoleType = EnumRoleType.Admin;
|
||||
currentUserID: number;
|
||||
/** Payroll type names by ID, for the Self Service Payroll Type column. */
|
||||
payrollTypeNames = new Map<number, string>();
|
||||
|
||||
// All assignments
|
||||
rows: AssignmentRow[] = [];
|
||||
|
|
@ -85,6 +90,10 @@ export class UserRoleListComponent implements OnInit {
|
|||
this.currentUserID = resp?.userID;
|
||||
this.loadPending();
|
||||
});
|
||||
this.userService.GetAllPayrollTypes().subscribe((resp: any[]) => {
|
||||
this.payrollTypeNames = new Map((resp ?? []).map(p => [p.id, p.description] as [number, string]));
|
||||
this.rows.forEach(r => r.payrollTypeName = this.payrollTypeName(r));
|
||||
});
|
||||
this.RefreshControl();
|
||||
}
|
||||
|
||||
|
|
@ -109,7 +118,7 @@ export class UserRoleListComponent implements OnInit {
|
|||
if (!row) {
|
||||
row = {
|
||||
key: 'u' + r.userID, userID: r.userID, employeeID: r.employeeID, loginID: r.loginIDView,
|
||||
userName: r.userNameView, roles: [], rolesText: '', pending: false, statusText: '',
|
||||
userName: r.userNameView, payrollTypeID: r.payrollTypeID, payrollTypeName: '', roles: [], rolesText: '', pending: false, statusText: '',
|
||||
};
|
||||
byUser.set(r.userID, row);
|
||||
}
|
||||
|
|
@ -120,7 +129,10 @@ export class UserRoleListComponent implements OnInit {
|
|||
}
|
||||
});
|
||||
this.rows = Array.from(byUser.values());
|
||||
this.rows.forEach(r => r.rolesText = r.roles.join(', '));
|
||||
this.rows.forEach(r => {
|
||||
r.rolesText = r.roles.join(', ');
|
||||
r.payrollTypeName = this.payrollTypeName(r);
|
||||
});
|
||||
this.markPendingRows();
|
||||
},
|
||||
(err: any) => {
|
||||
|
|
@ -133,6 +145,11 @@ export class UserRoleListComponent implements OnInit {
|
|||
);
|
||||
}
|
||||
|
||||
private payrollTypeName(row: AssignmentRow): string {
|
||||
const id = row.payrollTypeID;
|
||||
return id ? (this.payrollTypeNames.get(id) ?? '') : '';
|
||||
}
|
||||
|
||||
private pendingFor(row: AssignmentRow): PendingGroup {
|
||||
return this.pendingGroups.find(g => g.roleType == this.listRoleType && g.userID == row.userID);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user