fixed remove permission if role STAFF
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m6s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m6s
This commit is contained in:
parent
26732420c2
commit
c356a06899
1 changed files with 6 additions and 3 deletions
|
|
@ -73,7 +73,6 @@ export class KeycloakController extends Controller {
|
||||||
private profileRepo = AppDataSource.getRepository(Profile);
|
private profileRepo = AppDataSource.getRepository(Profile);
|
||||||
private profileEmpRepo = AppDataSource.getRepository(ProfileEmployee);
|
private profileEmpRepo = AppDataSource.getRepository(ProfileEmployee);
|
||||||
private posMasterRepository = AppDataSource.getRepository(PosMaster);
|
private posMasterRepository = AppDataSource.getRepository(PosMaster);
|
||||||
private employeePosMasterRepository = AppDataSource.getRepository(EmployeePosMaster);
|
|
||||||
private roleKeycloakRepo = AppDataSource.getRepository(RoleKeycloak);
|
private roleKeycloakRepo = AppDataSource.getRepository(RoleKeycloak);
|
||||||
|
|
||||||
@Get("user/{id}")
|
@Get("user/{id}")
|
||||||
|
|
@ -387,12 +386,16 @@ export class KeycloakController extends Controller {
|
||||||
);
|
);
|
||||||
if (!result) throw new Error("Failed. Cannot remove user's role.");
|
if (!result) throw new Error("Failed. Cannot remove user's role.");
|
||||||
|
|
||||||
if (profileId) {
|
// delete authRoleId in posMaster if roleId is "f1fff8db-0795-47c1-9952-f3c18d5b6172"
|
||||||
|
if (profileId && roleId === "f1fff8db-0795-47c1-9952-f3c18d5b6172") {
|
||||||
|
let _null: any = null;
|
||||||
|
const authRoleId = _null;
|
||||||
|
console.log(`Clearing authRoleId on position records for profile ${profileId}`);
|
||||||
try {
|
try {
|
||||||
await this.posMasterRepository
|
await this.posMasterRepository
|
||||||
.createQueryBuilder()
|
.createQueryBuilder()
|
||||||
.update(PosMaster)
|
.update(PosMaster)
|
||||||
.set({ authRoleId: '' })
|
.set({ authRoleId: authRoleId })
|
||||||
.where("current_holderId = :profileId", { profileId })
|
.where("current_holderId = :profileId", { profileId })
|
||||||
.execute();
|
.execute();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue