Show More
@@ -46,7 +46,7 b' from rhodecode.model.meta import Session' | |||||
46 | from rhodecode.model.db import User, Repository, UserFollowing, RepoGroup,\ |
|
46 | from rhodecode.model.db import User, Repository, UserFollowing, RepoGroup,\ | |
47 | RhodeCodeSetting, RepositoryField |
|
47 | RhodeCodeSetting, RepositoryField | |
48 | from rhodecode.model.forms import RepoForm, RepoFieldForm, RepoPermsForm |
|
48 | from rhodecode.model.forms import RepoForm, RepoFieldForm, RepoPermsForm | |
49 | from rhodecode.model.scm import ScmModel, RepoGroupList |
|
49 | from rhodecode.model.scm import ScmModel, RepoGroupList, RepoList | |
50 | from rhodecode.model.repo import RepoModel |
|
50 | from rhodecode.model.repo import RepoModel | |
51 | from rhodecode.lib.compat import json |
|
51 | from rhodecode.lib.compat import json | |
52 | from sqlalchemy.sql.expression import func |
|
52 | from sqlalchemy.sql.expression import func | |
@@ -123,10 +123,12 b' class ReposController(BaseRepoController' | |||||
123 |
|
123 | |||
124 | defaults = RepoModel()._get_defaults(repo_name) |
|
124 | defaults = RepoModel()._get_defaults(repo_name) | |
125 |
|
125 | |||
|
126 | _repos = Repository.query().order_by(Repository.repo_name).all() | |||
|
127 | read_access_repos = RepoList(_repos) | |||
126 | c.repos_list = [('', _('--REMOVE FORK--'))] |
|
128 | c.repos_list = [('', _('--REMOVE FORK--'))] | |
127 |
c.repos_list += [(x.repo_id, x.repo_name) |
|
129 | c.repos_list += [(x.repo_id, x.repo_name) | |
128 | Repository.query().order_by(Repository.repo_name).all() |
|
130 | for x in read_access_repos | |
129 | if x.repo_id != c.repo_info.repo_id] |
|
131 | if x.repo_id != c.repo_info.repo_id] | |
130 |
|
132 | |||
131 | defaults['id_fork_of'] = db_repo.fork.repo_id if db_repo.fork else '' |
|
133 | defaults['id_fork_of'] = db_repo.fork.repo_id if db_repo.fork else '' | |
132 | return defaults |
|
134 | return defaults |
@@ -197,6 +197,17 b' class _PermCheckIterator(object):' | |||||
197 | yield db_obj |
|
197 | yield db_obj | |
198 |
|
198 | |||
199 |
|
199 | |||
|
200 | class RepoList(_PermCheckIterator): | |||
|
201 | ||||
|
202 | def __init__(self, db_repo_list, perm_set=None): | |||
|
203 | if not perm_set: | |||
|
204 | perm_set = ['repository.read', 'repository.write', 'repository.admin'] | |||
|
205 | ||||
|
206 | super(RepoList, self).__init__(obj_list=db_repo_list, | |||
|
207 | obj_attr='repo_name', perm_set=perm_set, | |||
|
208 | perm_checker=HasRepoPermissionAny) | |||
|
209 | ||||
|
210 | ||||
200 | class RepoGroupList(_PermCheckIterator): |
|
211 | class RepoGroupList(_PermCheckIterator): | |
201 |
|
212 | |||
202 | def __init__(self, db_repo_group_list, perm_set=None): |
|
213 | def __init__(self, db_repo_group_list, perm_set=None): |
General Comments 0
You need to be logged in to leave comments.
Login now