1 import json
2 import simplejson
3 from coprs import exceptions
4 from flask import url_for
5
6 from coprs import app, db
7 from coprs.models import User, Group
8 from coprs.helpers import copr_url
9 from sqlalchemy import update
13
14 @classmethod
15 - def get(cls, username):
17
18 @classmethod
21
22 @classmethod
24 """
25 Raise InsufficientRightsException if given user cant update
26 given copr. Return None otherwise.
27 """
28
29
30
31 if not user.can_edit(copr):
32 raise exceptions.InsufficientRightsException(message)
33
34 @classmethod
36 """
37 Raises InsufficientRightsException if given user cant build in
38 given copr. Return None otherwise.
39 """
40
41 if not user.can_build_in(copr):
42 raise exceptions.InsufficientRightsException(message)
43
44 @classmethod
50
51 @classmethod
54
55 @classmethod
59
60 @classmethod
63
64 @classmethod
67
68 @classmethod
71
72 @classmethod
83
84 @classmethod
93
94 @classmethod
96 """ removes blacklisted groups from teams list
97 :type teams: list of str
98 :return: filtered teams
99 :rtype: list of str
100 """
101 blacklist = set(app.config.get("BLACKLISTED_GROUPS", []))
102 return filter(lambda t: t not in blacklist, teams)
103
104 @classmethod
106 if "BLACKLISTED_GROUPS" in app.config:
107 return fas_group in app.config["BLACKLISTED_GROUPS"]
108 else:
109 return False
110
111 @classmethod
125
130
131 - def dumps(self, pretty=False):
132 if pretty:
133 return simplejson.dumps(self.data, indent=2)
134 return json.dumps(self.data)
135
136 @property
143
144 @property
155
156 @property
161
162 @property
169
170 @property
176