Commit 9c5dcb4d authored by Antoine Millet's avatar Antoine Millet
Browse files

remove_right can now take None as index to remove all rules.

parent a92ae5e1
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -356,15 +356,18 @@ class CCConf(object):
        Remove a right rule from the provided account.

        :param login: the login of the account
        :param index: the index of the rule to delete
        :param index: the index of the rule to delete or None for all rules
        '''

        conf = self._get_conf(login)
        rights = conf['rights']
        if index is None:
            conf['rights'] = []
        else:
            try:
            rights.pop(index)
                conf['rights'].pop(index)
            except IndexError:
            raise CCConf.OutOfRangeIndexError('Bad rule index %s' % repr(index))
                raise CCConf.OutOfRangeIndexError('Bad rule index '
                                                  '%s' % repr(index))
        self._set_conf(login, conf)

    def list_accounts(self):