1 import json
2 from coprs import exceptions
3 from flask import url_for
4
5 from coprs import app, db
6 from coprs.models import User, Group
7 from coprs.helpers import copr_url
8 from sqlalchemy import update
12
13 @classmethod
14 - def get(cls, username):
16
17 @classmethod
20
21 @classmethod
23 """
24 Raise InsufficientRightsException if given user cant update
25 given copr. Return None otherwise.
26 """
27
28
29
30 if not user.can_edit(copr):
31 raise exceptions.InsufficientRightsException(message)
32
33 @classmethod
35 """
36 Raises InsufficientRightsException if given user cant build in
37 given copr. Return None otherwise.
38 """
39
40 if not user.can_build_in(copr):
41 raise exceptions.InsufficientRightsException(message)
42
43 @classmethod
49
50 @classmethod
53
54 @classmethod
58
59 @classmethod
62
63 @classmethod
66
67 @classmethod
70
71 @classmethod
82
83 @classmethod
92
93 @classmethod
95 """ removes blacklisted groups from teams list
96 :type teams: list of str
97 :return: filtered teams
98 :rtype: list of str
99 """
100 blacklist = set(app.config.get("BLACKLISTED_GROUPS", []))
101 return filter(lambda t: t not in blacklist, teams)
102
103 @classmethod
105 if "BLACKLISTED_GROUPS" in app.config:
106 return fas_group in app.config["BLACKLISTED_GROUPS"]
107 else:
108 return False
109
110 @classmethod
124
129
130 - def dumps(self, pretty=False):
131 if pretty:
132 return json.dumps(self.data, indent=2)
133 return json.dumps(self.data)
134
135 @property
142
143 @property
154
155 @property
160
161 @property
168
169 @property
175