How to use the stashy.errors.ok_or_error function in stashy

To help you get started, we’ve selected a few stashy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cosmin / stashy / stashy / admin / users.py View on Github external
    @ok_or_error
    def remove_group(self, user, group):
        """
        Remove the given group from the given user.
        """
        return self._client.post(self.url("/remove-group"), dict(context=user, itemName=group))
github cosmin / stashy / stashy / admin / groups.py View on Github external
    @ok_or_error
    def add_user(self, group, user):
        """
        Add a user to a group.
        """
        return self._client.post(self.url("/add-user"), dict(context=group, itemName=user))
github cosmin / stashy / stashy / repos.py View on Github external
    @ok_or_error
    def add_key(self, key_text, permission):
        return self._client.post(self.url('/ssh', is_keys=True),
                                 data=dict(key=dict(text=key_text),
                                           permission=permission))
github cosmin / stashy / stashy / repos.py View on Github external
    @ok_or_error
    def create_branch(self, value, origin_branch='master'):
        return self._client.post(self.url('/branches', is_branches=True),
                                 data=dict(name=value, startPoint=origin_branch))
github cosmin / stashy / stashy / repos.py View on Github external
    @ok_or_error
    def _set_default_branch(self, value):
        return self._client.put(self.url('/branches/default'), data=dict(id=value))
github cosmin / stashy / stashy / repos.py View on Github external
    @ok_or_error
    def delete_tag(self, name):
        return self._client.delete(self.url('/tags/' + name, is_git=True))
github cosmin / stashy / stashy / permissions.py View on Github external
    @ok_or_error
    def grant_to_group(self, group, permission):
        """
        Grant a repository permission to a single group, i.e. set the default permission.

        repository permissions:
            * REPO_READ
            * REPO_WRITE
            * REPO_ADMIN

        """
        return self._client.put(self._url_for_groups(), params=dict(name=group,
                                                              permission=permission))
github cosmin / stashy / stashy / permissions.py View on Github external
    @ok_or_error
    def grant(self, user, permission):
        """
        Promote or demote the permission level of a user.


        Depending on context, you may use one of the following set of permissions:

        global permissions:

            * LICENSED_USER
            * PROJECT_CREATE
            * ADMIN
            * SYS_ADMIN

        project permissions:
            * PROJECT_READ
github cosmin / stashy / stashy / admin / users.py View on Github external
    @ok_or_error
    def add_group(self, user, group):
        """
        Add the given group to the given user.
        """
        return self._client.post(self.url("/add-group"), dict(context=user, itemName=group))
github cosmin / stashy / stashy / permissions.py View on Github external
    @ok_or_error
    def revoke_from_user(self, user):
        """
        Revoke all repository permissions from a user.

        """
        return self._client.delete(self._url_for_users(), params=dict(name=user))