Show More
@@ -141,16 +141,15 b' def fill_perms(user):' | |||
|
141 | 141 | #=========================================================================== |
|
142 | 142 | # fetch default permissions |
|
143 | 143 | #=========================================================================== |
|
144 |
default_perms = sa.query(RepoToPerm, |
|
|
145 | .outerjoin((UserToPerm, RepoToPerm.user_id == UserToPerm.user_id))\ | |
|
144 | default_perms = sa.query(RepoToPerm, Repository, Permission)\ | |
|
146 | 145 | .join((Repository, RepoToPerm.repository_id == Repository.repo_id))\ |
|
147 | 146 | .join((Permission, RepoToPerm.permission_id == Permission.permission_id))\ |
|
148 |
.filter(RepoToPerm.user |
|
|
149 |
'default'). |
|
|
147 | .filter(RepoToPerm.user == sa.query(User).filter(User.username == | |
|
148 | 'default').scalar()).all() | |
|
150 | 149 | |
|
151 | 150 | if user.is_admin: |
|
152 | 151 | #======================================================================= |
|
153 | # #admin have all rights set to admin | |
|
152 | # #admin have all default rights set to admin | |
|
154 | 153 | #======================================================================= |
|
155 | 154 | user.permissions['global'].add('hg.admin') |
|
156 | 155 | |
@@ -164,8 +163,12 b' def fill_perms(user):' | |||
|
164 | 163 | #======================================================================= |
|
165 | 164 | |
|
166 | 165 | #default global |
|
167 | for perm in default_perms: | |
|
168 | user.permissions['global'].add(perm.UserToPerm.permission.permission_name) | |
|
166 | default_global_perms = sa.query(UserToPerm)\ | |
|
167 | .filter(UserToPerm.user == sa.query(User).filter(User.username == | |
|
168 | 'default').one()) | |
|
169 | ||
|
170 | for perm in default_global_perms: | |
|
171 | user.permissions['global'].add(perm.permission.permission_name) | |
|
169 | 172 | |
|
170 | 173 | #default repositories |
|
171 | 174 | for perm in default_perms: |
@@ -183,8 +186,7 b' def fill_perms(user):' | |||
|
183 | 186 | #======================================================================= |
|
184 | 187 | # #overwrite default with user permissions if any |
|
185 | 188 | #======================================================================= |
|
186 |
user_perms = sa.query(RepoToPerm, |
|
|
187 | .outerjoin((UserToPerm, RepoToPerm.user_id == UserToPerm.user_id))\ | |
|
189 | user_perms = sa.query(RepoToPerm, Permission, Repository)\ | |
|
188 | 190 | .join((Repository, RepoToPerm.repository_id == Repository.repo_id))\ |
|
189 | 191 | .join((Permission, RepoToPerm.permission_id == Permission.permission_id))\ |
|
190 | 192 | .filter(RepoToPerm.user_id == user.user_id).all() |
General Comments 0
You need to be logged in to leave comments.
Login now