def populate_user_data(self, db): self.collection = db.Users # Set Collection as Role self.RoleCollection = db.Role # Set Collection as Role self.AccountsCollection = db.Accounts passwordHelper = PasswordHelper.PasswordHelper(key) # Loop over the roles list and insert into the role collection if not # present for rec in dynamicInstanceOfInitData.USERS: # print roleName["name"] IsFound = self.get_record_from_user(rec["user"]) # print RolePermissionGroupObjMap if IsFound is None: rec["roleid"] = str( self.RoleCollection.find_one({"name": rec["roleid"]})["_id"]) rec["accountid"] = str( self.AccountsCollection.find_one( {"name": rec["accountid"]})["_id"]) rec["password"] = passwordHelper.encrypt(rec["password"]) self.insert_record(rec) count = self.get_all_count() if count >= len(dynamicInstanceOfInitData.USERS): print "Users data Populated Successful" else: raise ValueError("Insufficient Users detected. " + str(len(dynamicInstanceOfInitData.users) - count) + " entries are missing")
def __init__(self, db): ''' General description: This function initializes the database variables and \ index to refer in functions. ''' DBUtil.__init__(self, db) self.collection = db.Config self.passHelper = PasswordHelper.PasswordHelper(key)
def __init__(self, db): DBUtil.__init__(self, db) self.collection = db.Machine self.passHelper = PasswordHelper.PasswordHelper(key) self.userdb = Users.Users(db) self.roleDb = Role.Role(db) self.tagDB = Tags.Tags() # indexes self.collection.create_index([('username', ASCENDING), ('host', ASCENDING)], unique=True)
def __init__(self): ''' General description: This function initializes the database variables and \ index to refer in functions. ''' db = mongodb self.collection = db.ExitPointPlugins self.passHelper = PasswordHelper.PasswordHelper(key) # indexes self.collection.create_index([('plugin_name', ASCENDING)], unique=True)
def __init__(self): ''' General description: This function initializes the database variables and \ index to refer in functions. ''' db = mongodb DBUtil.__init__(self, db) self.collection = db.Repository self.passHelper = PasswordHelper.PasswordHelper(key) # indexes self.collection.create_index([('name', ASCENDING)], unique=True)
def __init__(self, db): ''' General description: This function initializes the database variables and \ index to refer in functions. ''' DBUtil.__init__(self, db) self.collection = db.DeploymentRequest self.machineDB = Machine.Machine(db) self.versionsDB = Versions.Versions(db) self.toolDB = Tool.Tool(db) self.passHelper = PasswordHelper.PasswordHelper(key) self.statedb = State.State(db)
def __init__(self, db): ''' General description: This function initializes the database variables and \ index to refer in functions. ''' DBUtil.__init__(self, db) self.collection = db.Users self.roledb = Role.Role(db) self.permissiondb = Permissions.Permissions(db) self.account_db = Accounts.Accounts() self.pass_helper = PasswordHelper.PasswordHelper(key) # indexes self.collection.create_index( [('user', ASCENDING)], unique=True, )
def __init__(self, db, key): self.RSAKEY = RSA.generate(1024) self.SECRET_KEY = self.RSAKEY.exportKey('PEM') self.SECRET_PUBLIC_KEY = self.RSAKEY.publickey().exportKey('PEM') self.ENCRYPTION_METHOD = 'RS512' # WE WILL VERIFY EXPIRATION BY OURSELVES self.JWT_OPTIONS = {'verify_exp': False, } self.userdb = Users.Users(db) self.auditdb = Auditing.Auditing() self.roledb = Role.Role(db) self.passHelper = PasswordHelper.PasswordHelper(key) self.permissiondb = Permissions.Permissions(db) self.permissiongroupdb = PermissionGroup.PermissionGroup(db) self.accountDB = Accounts.Accounts() self.configdb = Config.Config(db) self.systemDetailsDB = SystemDetails.SystemDetails(db) self.configdbData = self.configdb.getConfigByName("AuthService") # 6 is for AuthRequestService configuration self.auditing_config = self.configdb.getConfigByName("AuditingServices") # 6 is for AuthRequestService configuration self.mailer = Mailer.Mailer() self.validTokens = {} self.teamService = TeamService.TeamService() self.collection = db.SystemDetails # Set Collection as Permissions self.teamsdb = Teams.Teams(db) if self.configdbData is not None: if self.configdbData.get("expiration") is not None: self.expiration = int(self.configdbData.get("expiration")) else: raise Exception( "Config AuthService does not have expiration set") if self.configdbData.get("email_domain") is not None: self.email_domain = str(self.configdbData.get("email_domain")) else: raise Exception( "Config AuthService does not have email_domain set") self.allow_multi_user_session = self.configdbData.get("allow_multi_user_session","false") else: raise Exception("Config was not found for Authorization services") # ADD DEAMON THREAD TO REMOVE IN VALID TOKENS AUTOMATICALLY pool = ThreadPoolExecutor(2,__name__+".__init__") pool.submit(self.removeInvalidTokens) pool.submit(self.check_if_user_logged_in_from_last_6_months)
userdb = Users.Users(db) accountDB = Accounts.Accounts() tooldb = Tool.Tool(db) versionsDB = Versions.Versions(db) toolsonmachinedb = ToolsOnMachine.ToolsOnMachine(db) remoteAuthenticationService = RemoteAuthenticationService.RemoteAuthenticationService( ) machinegroupDB = MachineGroups.MachineGroups(db) roleDb = Role.Role(db) deploymentUnitDb = DeploymentUnit.DeploymentUnit() teamService = TeamService.TeamService() distributionMachinetDB = DistributionMachine.DistributionMachine(db) teamsDb = Teams.Teams(db) deploymentRequestDb = DeploymentRequest.DeploymentRequest(db) buildDB = Build.Build() passHelper = PasswordHelper.PasswordHelper(key) # MachineType - ********************************************************** @machineAPI.route('/machine/type/all', methods=['GET']) @authService.authorized @swag_from(relative_path + '/swgger/MachineAPI/getAllMachineTypes.yml') def get_all_machine_types(): type_list = machineTypeDb.get_all_machine_type() return jsonify(json.loads(dumps({ "result": "success", "data": type_list }))), 200 @machineAPI.route('/machine/fav/user/<string:id>', methods=['GET'])