Beispiel #1
0
 def __init__(self, username, home):
     """
     :param FilePath home: The path of the directory to use as this user's
         home directory.
     """
     UnixConchUser.__init__(self, username)
     self._home = home
Beispiel #2
0
 def __init__(self, username, home):
     """
     :param FilePath home: The path of the directory to use as this user's
         home directory.
     """
     UnixConchUser.__init__(self, username)
     self._home = home
Beispiel #3
0
    def __init__(self, unix_username, cw_session_ids, login, cw_instance_names,
                 cw_repositories, base_dir):
        """ Initialize the CubicWebConchUser class.

        Parameters
        ----------
        unix_username: str (mandatory)
            the sftp server will read file system with the permission
            associated to this user.
        cw_session_ids: list of str (mandatory)
            the cubicweb sessions identifiers.
        login: str (mandatory)
            the cubicweb user login.
        cw_instance_names: list of str (mandatory)
            the cubicweb instance names.
        cw_repositories: cubicweb.server.repository.Repository (mandatory)
            internal cubicweb connections.
        base_dir: str (mandatory)
            base directory in which file are stored (it acts as
            mask, so every files outside this base_dir will be
            invisible).
        """
        # Inheritance
        UnixConchUser.__init__(self, unix_username)

        # Class parameters
        self.login = login

        # create the session associated to each repository
        self.cw_sessions = []
        self.cw_users = []
        self.instance_names = []
        for cnt, item in enumerate(
                zip(cw_session_ids, cw_repositories, cw_instance_names)):

            # Unpack items
            sessionid, repo, instance_name = item

            # Get the corresponding cw session
            session = repo._get_session(sessionid)
            self.cw_sessions.append(session)

            # Get the user entity eid
            with repo.internal_cnx() as cnx:
                login_eid = cnx.execute(
                    "Any X WHERE X is CWUser, X login '{0}'".format(login))
            self.cw_users.append(login_eid[0][0])

            # Store the instance name: assume the name is unique
            self.instance_names.append(instance_name)

        # Create a Search object that provides tools to filter the CWSearch
        # elements
        search_filter = Search(self.cw_sessions, cwusers=self.cw_users)

        # Create an object to translate the paths contained in the CWSearch
        # elements
        self.path_translator = VirtualPathTranslator(search_filter)
        self.path_translator.BASE_REAL_DIR = base_dir
        self.path_translator.INSTANCE_NAMES = self.instance_names
Beispiel #4
0
    def __init__(self, unix_username, cw_session_ids, login, cw_instance_names,
                 cw_repositories, base_dir):
        """ Initialize the CubicWebConchUser class.

        Parameters
        ----------
        unix_username: str (mandatory)
            the sftp server will read file system with the permission
            associated to this user.            
        cw_session_ids: list of str (mandatory)
            the cubicweb sessions identifiers.
        login: str (mandatory)
            the cubicweb user login.
        cw_instance_names: list of str (mandatory)
            the cubicweb instance names.
        cw_repositories: cubicweb.server.repository.Repository (mandatory)
            internal cubicweb connections.
        base_dir: str (mandatory)
            base directory in which file are stored (it acts as
            mask, so every files outside this base_dir will be
            invisible).
        """
        # Inheritance
        UnixConchUser.__init__(self, unix_username)

        # Class parameters
        self.login = login

        # create the session associated to each repository
        self.cw_sessions = []
        self.cw_users = []
        self.instance_names = []
        for cnt, item in enumerate(
                zip(cw_session_ids, cw_repositories, cw_instance_names)):

            # Unpack items
            sessionid, repo, instance_name = item

            # Get the corresponding cw session
            session = repo._get_session(sessionid)  # XXX private method
            session.set_cnxset()
            self.cw_sessions.append(session)

            # Get the user entity eid
            login_eid = session.execute(
                "Any X WHERE X is CWUser, X login '{0}'".format(login))
            self.cw_users.append(login_eid[0][0])

            # Store the instance name: assume the name is unique
            self.instance_names.append(instance_name)

        # Create a Search object that provides tools to filter the CWSearch
        # elements
        search_filter = Search(self.cw_sessions, cwusers=self.cw_users)

        # Create an object to translate the paths contained in the CWSearch
        # elements
        self.path_translator = VirtualPathTranslator(search_filter)
        self.path_translator.BASE_REAL_DIR = base_dir
        self.path_translator.INSTANCE_NAMES = self.instance_names
 def __init__(self, unix_username, cw_sessionid, login, repo, base_dir):
     UnixConchUser.__init__(self, unix_username)
     self.session = repo._get_session(cw_sessionid)  # XXX private method
     self.session.set_cnxset()
     login_eid = self.session.execute('Any X WHERE X is CWUser, '
                                      'X login %(login)s', {'login': login})
     s = Search(self.session, cwuser=login_eid[0][0])
     self.path_translator = VirtualPathTranslator(s)
     self.path_translator.BASE_REAL_DIR = base_dir
 def __init__(self, unix_username, cw_sessionid, login, repo, base_dir):
     UnixConchUser.__init__(self, unix_username)
     self.session = repo._get_session(cw_sessionid)  # XXX private method
     self.session.set_cnxset()
     login_eid = self.session.execute(
         'Any X WHERE X is CWUser, '
         'X login %(login)s', {'login': login})
     s = Search(self.session, cwuser=login_eid[0][0])
     self.path_translator = VirtualPathTranslator(s)
     self.path_translator.BASE_REAL_DIR = base_dir
Beispiel #7
0
 def __init__(self, username):
     #avatar.ConchUser.__init__(self)
     UnixConchUser.__init__(self,'ashah')
     self.username = username
     self.channelLookup.update({'session':session.SSHSession})