vaultmanager/modules/VaultManagerLDAP.py
def ldap_create_users_secrets(self):
        """
        Method running the create-users-secrets function of LDAP module
        Create a secret folder for each LDAP user under specified path
        """
        self.logger.debug("LDAP create-users-secrets starting")
        self.logger.info("Creating users folders under secret path '/%s'" %
                         self.kwargs.create_users_secrets)
        self.logger.debug("Creating users secrets under %s" %
                          self.kwargs.create_users_secrets)
        enabled_users = []
        for user in self.ldap_users:
            groups_of_user = list(
                set(self.conf["groups"]["groups_to_add"]).intersection(
                    self.ldap_users[user]))
            if len(groups_of_user):
                enabled_users.append(user)
        existing_folders = self.vault_client.list(
            self.kwargs.create_users_secrets
        )
        if len(existing_folders):
            existing_folders = [e.replace("/", "") for e in
                                existing_folders['keys']]
        self.logger.debug("Already existing folders: " + str(existing_folders))
        for user in enabled_users:
            if user not in existing_folders:
                self.logger.info("Creating folder: " + user)
                self.vault_client.write(
                    self.kwargs.create_users_secrets + "/" + user + "/description",
                    {user: "user private secrets space"})
        for user in existing_folders:
            if user not in enabled_users:
                tree = self.vault_client.get_secrets_tree(
                    self.kwargs.create_users_secrets + "/" + user)
                self.logger.info(
                    "Deleting folder " + user + " and associated secrets " + str(
                        tree))
                for secret in tree:
                    self.vault_client.delete(secret)

        Method running the create-users-secrets function of LDAP module
        Create a secret folder for each LDAP user under specified path
        
Method running the create-users-secrets function of LDAP module
Create a secret folder for each LDAP user under specified path
Method running the create - users - secrets function of LDAP module Create a secret folder for each LDAP user under specified path
def ldap_create_users_secrets(self):
        self.logger.debug("LDAP create-users-secrets starting")
        self.logger.info("Creating users folders under secret path '/%s'" %
                         self.kwargs.create_users_secrets)
        self.logger.debug("Creating users secrets under %s" %
                          self.kwargs.create_users_secrets)
        enabled_users = []
        for user in self.ldap_users:
            groups_of_user = list(
                set(self.conf["groups"]["groups_to_add"]).intersection(
                    self.ldap_users[user]))
            if len(groups_of_user):
                enabled_users.append(user)
        existing_folders = self.vault_client.list(
            self.kwargs.create_users_secrets
        )
        if len(existing_folders):
            existing_folders = [e.replace("/", "") for e in
                                existing_folders['keys']]
        self.logger.debug("Already existing folders: " + str(existing_folders))
        for user in enabled_users:
            if user not in existing_folders:
                self.logger.info("Creating folder: " + user)
                self.vault_client.write(
                    self.kwargs.create_users_secrets + "/" + user + "/description",
                    {user: "user private secrets space"})
        for user in existing_folders:
            if user not in enabled_users:
                tree = self.vault_client.get_secrets_tree(
                    self.kwargs.create_users_secrets + "/" + user)
                self.logger.info(
                    "Deleting folder " + user + " and associated secrets " + str(
                        tree))
                for secret in tree:
                    self.vault_client.delete(secret)
def ldap_create_users_secrets ( self ) : self . logger . debug ( "LDAP create-users-secrets starting" ) self . logger . info ( "Creating users folders under secret path '/%s'" % self . kwargs . create_users_secrets ) self . logger . debug ( "Creating users secrets under %s" % self . kwargs . create_users_secrets ) enabled_users = [ ] for user in self . ldap_users : groups_of_user = list ( set ( self . conf [ "groups" ] [ "groups_to_add" ] ) . intersection ( self . ldap_users [ user ] ) ) if len ( groups_of_user ) : enabled_users . append ( user ) existing_folders = self . vault_client . list ( self . kwargs . create_users_secrets ) if len ( existing_folders ) : existing_folders = [ e . replace ( "/" , "" ) for e in existing_folders [ 'keys' ] ] self . logger . debug ( "Already existing folders: " + str ( existing_folders ) ) for user in enabled_users : if user not in existing_folders : self . logger . info ( "Creating folder: " + user ) self . vault_client . write ( self . kwargs . create_users_secrets + "/" + user + "/description" , { user : "user private secrets space" } ) for user in existing_folders : if user not in enabled_users : tree = self . vault_client . get_secrets_tree ( self . kwargs . create_users_secrets + "/" + user ) self . logger . info ( "Deleting folder " + user + " and associated secrets " + str ( tree ) ) for secret in tree : self . vault_client . delete ( secret )
Method running the create-users-secrets function of LDAP module
Create a secret folder for each LDAP user under specified path
Method running the create - users - secrets function of LDAP module Create a secret folder for each LDAP user under specified path
"""
        Method running the create-users-secrets function of LDAP module
        Create a secret folder for each LDAP user under specified path
        """
self