perf(auth): changed the way logs look in the setRoles
This commit is contained in:
@@ -4,6 +4,7 @@ import {db} from "../../../../../database/dbclient.js";
|
||||
import {userRoles} from "../../../../../database/schema/userRoles.js";
|
||||
import {modules} from "../../../../../database/schema/modules.js";
|
||||
import {roles} from "../../../../../database/schema/roles.js";
|
||||
import {createLog} from "../../../logger/logger.js";
|
||||
|
||||
export const setSysAdmin = async (user: any, roleName: any): Promise<void> => {
|
||||
// remove all userRoles to prevent errors
|
||||
@@ -25,9 +26,14 @@ export const setSysAdmin = async (user: any, roleName: any): Promise<void> => {
|
||||
module_id: module[i].module_id,
|
||||
role: roleName,
|
||||
});
|
||||
console.log(`${user[0].username} has been granted access to ${module[i].name} with the role ${roleName}`);
|
||||
createLog(
|
||||
"info",
|
||||
user[0].username,
|
||||
"auth",
|
||||
`${user[0].username} has been granted access to ${module[i].name} with the role ${roleName}`
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
createLog("info", "lst", "auth", `Error settings user access: ${error}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user