styles bugfix
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
const jwt = require('jsonwebtoken');
|
||||
const sequelize = require('sequelize');
|
||||
|
||||
class RBACManager {
|
||||
constructor(databaseModel, SECRET_KEY) {
|
||||
constructor(databaseModel, SECRET_KEY, service) {
|
||||
this.db = databaseModel;
|
||||
this.SECRET_KEY = SECRET_KEY;
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
async resolvePermissions(objectGuid) {
|
||||
@@ -246,6 +248,29 @@ async getAuth() {
|
||||
return await Auth.findAll({ raw: true });
|
||||
}
|
||||
|
||||
|
||||
async syncAuthByActiveDirectory() {
|
||||
const auth = await this.db.get('authentication');
|
||||
const all = await this.service.get('activeDirectoryManager').getAllUsers();
|
||||
|
||||
await Promise.all(
|
||||
all.map(async (user) => {
|
||||
user = {...user, userAccountControl_ID: user.userAccountControl};
|
||||
const [record, created] = await auth.findOrCreate({
|
||||
where: { dn: user.dn },
|
||||
defaults: user
|
||||
});
|
||||
|
||||
if (!created) {
|
||||
await record.update(user);
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
// return all;
|
||||
}
|
||||
|
||||
|
||||
async createAuth(data) {
|
||||
const Auth = this.db.get('authentication');
|
||||
|
||||
@@ -429,7 +454,6 @@ async getPermission() {
|
||||
return await permission.findAll({ raw: true }) || [];
|
||||
}
|
||||
|
||||
|
||||
async createPermission(data) {
|
||||
const Permission = this.db.get('permissionModel');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user