Commit dfc55d6f authored by Antoine Millet's avatar Antoine Millet
Browse files

Added a feature to CCConf class to copy an account.

parent fc0b4b43
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -325,6 +325,25 @@ class CCConf(object):
                conf['password'] = self._hash_password(password)
            self._set_conf(login, conf, create=True)

    @writer
    def copy_account(self, copy_login, login, password):
        '''
        Create a new account based on another.

        :param copy_login: the login of the account to copy.
        :param password: password of the new user
        :param role: the role of the new user
        :raise CCConf.AlreadyExistingAccount: if the login is already
        :raise CCConf.UnknownAccount: if the copy login doesn't exist
        '''

        conf_copy = self._get_conf(copy_login)
        self.create_account(login, conf_copy['role'], password)
        password = self._get_conf(login)['password']
        conf_copy['password'] = password
        self._set_conf(login, conf_copy)
        

    @writer
    def add_right(self, login, tql, method=None, target='allow', index=None):
        '''