huskar_api/api/auth.py
def post(self):
        """Grants an user to site admin.

        :form username: The username of granted user.
        :<header Authorization: Huskar Token (See :ref:`token`)
        :status 404: The user is not found.
        :status 200: The user is a site admin already.
        :status 201: The user has been granted successfully.
        """
        g.auth.require_admin('only admin can add huskar admin')

        user = self._get_user_or_404(request.form['username'])
        if user and user.is_admin:
            return api_response(), 200
        with audit_log(audit_log.types.GRANT_HUSKAR_ADMIN, user=user):
            user.grant_admin()
        return api_response(), 201
Grants an user to site admin.

        :form username: The username of granted user.
        :<header Authorization: Huskar Token (See :ref:`token`)
        :status 404: The user is not found.
        :status 200: The user is a site admin already.
        :status 201: The user has been granted successfully.
        
Grants an user to site admin.
Grants an user to site admin .
def post(self):
        g.auth.require_admin('only admin can add huskar admin')
        user = self._get_user_or_404(request.form['username'])
        if user and user.is_admin:
            return api_response(), 200
        with audit_log(audit_log.types.GRANT_HUSKAR_ADMIN, user=user):
            user.grant_admin()
        return api_response(), 201
def post ( self ) : g . auth . require_admin ( 'only admin can add huskar admin' ) user = self . _get_user_or_404 ( request . form [ 'username' ] ) if user and user . is_admin : return api_response ( ) , 200 with audit_log ( audit_log . types . GRANT_HUSKAR_ADMIN , user = user ) : user . grant_admin ( ) return api_response ( ) , 201
Grants an user to site admin.
Grants an user to site admin .
"""Grants an user to site admin.

        :form username: The username of granted user.
        :<header Authorization: Huskar Token (See :ref:`token`)
        :status 404: The user is not found.
        :status 200: The user is a site admin already.
        :status 201: The user has been granted successfully.
        """
self
form
The username of granted user.
The username of granted user .
<header
Huskar Token (See :ref:`token`)
Huskar Token ( See : ref : ` token ` )
status
The user is not found.
The user is not found .
status
The user is a site admin already.
The user is a site admin already .
status
The user has been granted successfully.
The user has been granted successfully .