Completed
Push — master ( 895fc6...31d0bd )
by Glenn
01:16
created

userListPrivileges.get()   A

Complexity

Conditions 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 11
rs 9.4285
cc 1
1
from flask import request
0 ignored issues
show
Unused Code introduced by Martin Marsicano
Unused request imported from flask
Loading history...
2
from flask_restplus import Resource
3
from skf.api.security import security_headers, validate_privilege
4
from skf.api.user.business import list_privileges
5
from skf.api.user.serializers import privilege_items, message
6
from skf.api.user.parsers import authorization
7
from skf.api.restplus import api
8
9
ns = api.namespace('user', description='Operations related to users')
10
11
12
@ns.route('/list_privileges')
13
@api.response(404, 'Validation error', message)
14
class userListPrivileges(Resource):
15
16
    @api.expect(authorization)
17
    @api.marshal_with(privilege_items)
18
    @api.response(400, 'No results found', message)
19
    def get(self):
20
        """
21
        List available users.
22
        * Privileges required: **manage**
23
        """
24
        validate_privilege(self, 'manage')
25
        result = list_privileges()
26
        return result, 200, security_headers()
27