vaultmanager/modules/VaultManagerLDAP.py
def create_users_policies(self):
        """
        Create policies for each LDAP user
        """
        self.logger.info("Creating user policies")
        with open(os.path.join(self.policies_folder,
                               self.conf["general"]["user"]["default_policy"]),
                  'r') as fd:
            default_policy = fd.read()
        for user in self.ldap_users:
            if len(set(self.conf["groups"]["groups_to_add"]).intersection(
                    self.ldap_users[user])):
                policy_file = os.path.join(self.user_policies_folder,
                                           user + ".hcl")
                self.user_policies_to_create.append(policy_file)
                if os.path.isfile(policy_file):
                    self.logger.info(
                        "Policy for user " + user +
                        " already exists and will not be overwritten")
                else:
                    with open(policy_file, 'w+') as fd:
                        fd.write(default_policy.replace("{{USER_NAME}}", user))
                        self.logger.info(
                            "Policy for user " + user + " created")

        Create policies for each LDAP user
        
Create policies for each LDAP user
Create policies for each LDAP user
def create_users_policies(self):
        self.logger.info("Creating user policies")
        with open(os.path.join(self.policies_folder,
                               self.conf["general"]["user"]["default_policy"]),
                  'r') as fd:
            default_policy = fd.read()
        for user in self.ldap_users:
            if len(set(self.conf["groups"]["groups_to_add"]).intersection(
                    self.ldap_users[user])):
                policy_file = os.path.join(self.user_policies_folder,
                                           user + ".hcl")
                self.user_policies_to_create.append(policy_file)
                if os.path.isfile(policy_file):
                    self.logger.info(
                        "Policy for user " + user +
                        " already exists and will not be overwritten")
                else:
                    with open(policy_file, 'w+') as fd:
                        fd.write(default_policy.replace("{{USER_NAME}}", user))
                        self.logger.info(
                            "Policy for user " + user + " created")
def create_users_policies ( self ) : self . logger . info ( "Creating user policies" ) with open ( os . path . join ( self . policies_folder , self . conf [ "general" ] [ "user" ] [ "default_policy" ] ) , 'r' ) as fd : default_policy = fd . read ( ) for user in self . ldap_users : if len ( set ( self . conf [ "groups" ] [ "groups_to_add" ] ) . intersection ( self . ldap_users [ user ] ) ) : policy_file = os . path . join ( self . user_policies_folder , user + ".hcl" ) self . user_policies_to_create . append ( policy_file ) if os . path . isfile ( policy_file ) : self . logger . info ( "Policy for user " + user + " already exists and will not be overwritten" ) else : with open ( policy_file , 'w+' ) as fd : fd . write ( default_policy . replace ( "{{USER_NAME}}" , user ) ) self . logger . info ( "Policy for user " + user + " created" )
Create policies for each LDAP user
Create policies for each LDAP user
"""
        Create policies for each LDAP user
        """
self