Mercurial > public > src > rhodecode
annotate rhodecode/controllers/admin/repos.py @ 597:b75b77ef649d
renamed hg_app to rhodecode
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 06 Oct 2010 03:22:52 +0200 |
parents | 1e757ac98988 |
children | ba7e24cd4786 |
rev | line source |
---|---|
252
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
248
diff
changeset
|
1 #!/usr/bin/env python |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
248
diff
changeset
|
2 # encoding: utf-8 |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
248
diff
changeset
|
3 # repos controller for pylons |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
248
diff
changeset
|
4 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
401
5cd6616b8673
routes python 2.5 compatible
Marcin Kuzminski <marcin@python-works.com>
parents:
391
diff
changeset
|
5 # |
252
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
248
diff
changeset
|
6 # This program is free software; you can redistribute it and/or |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
248
diff
changeset
|
7 # modify it under the terms of the GNU General Public License |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
248
diff
changeset
|
8 # as published by the Free Software Foundation; version 2 |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
248
diff
changeset
|
9 # of the License or (at your opinion) any later version of the license. |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
248
diff
changeset
|
10 # |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
248
diff
changeset
|
11 # This program is distributed in the hope that it will be useful, |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
248
diff
changeset
|
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
248
diff
changeset
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
248
diff
changeset
|
14 # GNU General Public License for more details. |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
248
diff
changeset
|
15 # |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
248
diff
changeset
|
16 # You should have received a copy of the GNU General Public License |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
248
diff
changeset
|
17 # along with this program; if not, write to the Free Software |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
248
diff
changeset
|
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
3782a6d698af
licensing updates, code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
248
diff
changeset
|
19 # MA 02110-1301, USA. |
391
ec7b76d4bda4
Added initial query skipp when seting up the app.
Marcin Kuzminski <marcin@python-works.com>
parents:
383
diff
changeset
|
20 """ |
ec7b76d4bda4
Added initial query skipp when seting up the app.
Marcin Kuzminski <marcin@python-works.com>
parents:
383
diff
changeset
|
21 Created on April 7, 2010 |
ec7b76d4bda4
Added initial query skipp when seting up the app.
Marcin Kuzminski <marcin@python-works.com>
parents:
383
diff
changeset
|
22 admin controller for pylons |
ec7b76d4bda4
Added initial query skipp when seting up the app.
Marcin Kuzminski <marcin@python-works.com>
parents:
383
diff
changeset
|
23 @author: marcink |
ec7b76d4bda4
Added initial query skipp when seting up the app.
Marcin Kuzminski <marcin@python-works.com>
parents:
383
diff
changeset
|
24 """ |
331
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
312
diff
changeset
|
25 from formencode import htmlfill |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
26 from operator import itemgetter |
408
7fbf81447c6c
Fixes #18, removing user, who owns some repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
401
diff
changeset
|
27 from paste.httpexceptions import HTTPInternalServerError |
331
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
312
diff
changeset
|
28 from pylons import request, response, session, tmpl_context as c, url |
215
70f645fa97cc
Moved repo creation to admin/repos, as part of crud controller. Now repo creation is based on a form, which can be auto filled with data from 404 page. Fixed the error controller to properly give the repo name.
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
29 from pylons.controllers.util import abort, redirect |
248
fb7f066126cc
Added support for repository located in subdirectories.
Marcin Kuzminski <marcin@python-works.com>
parents:
247
diff
changeset
|
30 from pylons.i18n.translation import _ |
596
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
585
diff
changeset
|
31 from rhodecode.lib import helpers as h |
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
585
diff
changeset
|
32 from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator, \ |
412
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
33 HasPermissionAnyDecorator |
596
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
585
diff
changeset
|
34 from rhodecode.lib.base import BaseController, render |
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
585
diff
changeset
|
35 from rhodecode.lib.utils import invalidate_cache, action_logger |
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
585
diff
changeset
|
36 from rhodecode.model.db import User |
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
585
diff
changeset
|
37 from rhodecode.model.forms import RepoForm |
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
585
diff
changeset
|
38 from rhodecode.model.hg_model import HgModel |
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
585
diff
changeset
|
39 from rhodecode.model.repo_model import RepoModel |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
40 import formencode |
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
41 import logging |
382
b0715a788432
Added new style error display,
Marcin Kuzminski <marcin@python-works.com>
parents:
339
diff
changeset
|
42 import traceback |
391
ec7b76d4bda4
Added initial query skipp when seting up the app.
Marcin Kuzminski <marcin@python-works.com>
parents:
383
diff
changeset
|
43 |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
44 log = logging.getLogger(__name__) |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
45 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
46 class ReposController(BaseController): |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
47 """REST Controller styled on the Atom Publishing Protocol""" |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
48 # To properly map this controller, ensure your config/routing.py |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
49 # file has a resource setup: |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
50 # map.resource('repo', 'repos') |
331
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
312
diff
changeset
|
51 |
235
fcab58c43ea1
Fixed access to repos and users.
Marcin Kuzminski <marcin@python-works.com>
parents:
220
diff
changeset
|
52 @LoginRequired() |
453
3ed2d46a2ca7
permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents:
432
diff
changeset
|
53 @HasPermissionAnyDecorator('hg.admin', 'hg.create.repository') |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
54 def __before__(self): |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
55 c.admin_user = session.get('admin_user') |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
56 c.admin_username = session.get('admin_username') |
191
b68b2246e5a6
Authenticated controller with LoginRequired decorator, and cleaned __before__ (used in baseController now). fixed User for clone url with logged in session user.
Marcin Kuzminski <marcin@python-works.com>
parents:
169
diff
changeset
|
57 super(ReposController, self).__before__() |
412
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
58 |
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
59 @HasPermissionAllDecorator('hg.admin') |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
60 def index(self, format='html'): |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
61 """GET /repos: All items in the collection""" |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
62 # url('repos') |
246
ca80f8c00562
Fixed bug in repos, added dependencies and bumped version
Marcin Kuzminski <marcin@python-works.com>
parents:
235
diff
changeset
|
63 cached_repo_list = HgModel().get_repos() |
247
51434007e21d
proper sorting fix
Marcin Kuzminski <marcin@python-works.com>
parents:
246
diff
changeset
|
64 c.repos_list = sorted(cached_repo_list, key=itemgetter('name_sort')) |
127
20dc7a5eb748
Html changes and cleanups, made folders for html templates, implemented tags and branches pages
Marcin Kuzminski <marcin@python-works.com>
parents:
101
diff
changeset
|
65 return render('admin/repos/repos.html') |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
66 |
453
3ed2d46a2ca7
permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents:
432
diff
changeset
|
67 @HasPermissionAnyDecorator('hg.admin', 'hg.create.repository') |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
68 def create(self): |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
69 """POST /repos: Create a new item""" |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
70 # url('repos') |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
71 repo_model = RepoModel() |
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
72 _form = RepoForm()() |
383
ebdd1a89cdd9
Added extra validation in creating users.
Marcin Kuzminski <marcin@python-works.com>
parents:
382
diff
changeset
|
73 form_result = {} |
215
70f645fa97cc
Moved repo creation to admin/repos, as part of crud controller. Now repo creation is based on a form, which can be auto filled with data from 404 page. Fixed the error controller to properly give the repo name.
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
74 try: |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
75 form_result = _form.to_python(dict(request.POST)) |
597
b75b77ef649d
renamed hg_app to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
596
diff
changeset
|
76 repo_model.create(form_result, c.rhodecode_user) |
215
70f645fa97cc
Moved repo creation to admin/repos, as part of crud controller. Now repo creation is based on a form, which can be auto filled with data from 404 page. Fixed the error controller to properly give the repo name.
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
77 invalidate_cache('cached_repo_list') |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
78 h.flash(_('created repository %s') % form_result['repo_name'], |
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
79 category='success') |
585
48be953851fc
extended user logs to create/delete/fork repositories for auditing
Marcin Kuzminski <marcin@python-works.com>
parents:
453
diff
changeset
|
80 |
48be953851fc
extended user logs to create/delete/fork repositories for auditing
Marcin Kuzminski <marcin@python-works.com>
parents:
453
diff
changeset
|
81 if request.POST.get('user_created'): |
597
b75b77ef649d
renamed hg_app to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
596
diff
changeset
|
82 action_logger(self.rhodecode_user, 'user_created_repo', |
585
48be953851fc
extended user logs to create/delete/fork repositories for auditing
Marcin Kuzminski <marcin@python-works.com>
parents:
453
diff
changeset
|
83 form_result['repo_name'], '', self.sa) |
48be953851fc
extended user logs to create/delete/fork repositories for auditing
Marcin Kuzminski <marcin@python-works.com>
parents:
453
diff
changeset
|
84 else: |
597
b75b77ef649d
renamed hg_app to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
596
diff
changeset
|
85 action_logger(self.rhodecode_user, 'admin_created_repo', |
585
48be953851fc
extended user logs to create/delete/fork repositories for auditing
Marcin Kuzminski <marcin@python-works.com>
parents:
453
diff
changeset
|
86 form_result['repo_name'], '', self.sa) |
48be953851fc
extended user logs to create/delete/fork repositories for auditing
Marcin Kuzminski <marcin@python-works.com>
parents:
453
diff
changeset
|
87 |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
88 except formencode.Invalid as errors: |
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
89 c.new_repo = errors.value['repo_name'] |
412
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
90 |
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
91 if request.POST.get('user_created'): |
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
92 r = render('admin/repos/repo_add_create_repository.html') |
585
48be953851fc
extended user logs to create/delete/fork repositories for auditing
Marcin Kuzminski <marcin@python-works.com>
parents:
453
diff
changeset
|
93 else: |
412
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
94 r = render('admin/repos/repo_add.html') |
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
95 |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
96 return htmlfill.render( |
412
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
97 r, |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
98 defaults=errors.value, |
382
b0715a788432
Added new style error display,
Marcin Kuzminski <marcin@python-works.com>
parents:
339
diff
changeset
|
99 errors=errors.error_dict or {}, |
b0715a788432
Added new style error display,
Marcin Kuzminski <marcin@python-works.com>
parents:
339
diff
changeset
|
100 prefix_error=False, |
b0715a788432
Added new style error display,
Marcin Kuzminski <marcin@python-works.com>
parents:
339
diff
changeset
|
101 encoding="UTF-8") |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
102 |
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
103 except Exception: |
382
b0715a788432
Added new style error display,
Marcin Kuzminski <marcin@python-works.com>
parents:
339
diff
changeset
|
104 log.error(traceback.format_exc()) |
383
ebdd1a89cdd9
Added extra validation in creating users.
Marcin Kuzminski <marcin@python-works.com>
parents:
382
diff
changeset
|
105 msg = _('error occured during creation of repository %s') \ |
ebdd1a89cdd9
Added extra validation in creating users.
Marcin Kuzminski <marcin@python-works.com>
parents:
382
diff
changeset
|
106 % form_result.get('repo_name') |
382
b0715a788432
Added new style error display,
Marcin Kuzminski <marcin@python-works.com>
parents:
339
diff
changeset
|
107 h.flash(msg, category='error') |
412
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
108 if request.POST.get('user_created'): |
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
109 return redirect(url('hg_home')) |
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
110 return redirect(url('repos')) |
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
111 |
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
112 @HasPermissionAllDecorator('hg.admin') |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
113 def new(self, format='html'): |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
114 """GET /repos/new: Form to create a new item""" |
215
70f645fa97cc
Moved repo creation to admin/repos, as part of crud controller. Now repo creation is based on a form, which can be auto filled with data from 404 page. Fixed the error controller to properly give the repo name.
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
115 new_repo = request.GET.get('repo', '') |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
116 c.new_repo = h.repo_name_slug(new_repo) |
215
70f645fa97cc
Moved repo creation to admin/repos, as part of crud controller. Now repo creation is based on a form, which can be auto filled with data from 404 page. Fixed the error controller to properly give the repo name.
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
117 |
70f645fa97cc
Moved repo creation to admin/repos, as part of crud controller. Now repo creation is based on a form, which can be auto filled with data from 404 page. Fixed the error controller to properly give the repo name.
Marcin Kuzminski <marcin@python-works.com>
parents:
191
diff
changeset
|
118 return render('admin/repos/repo_add.html') |
412
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
119 |
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
120 @HasPermissionAllDecorator('hg.admin') |
312
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
121 def update(self, repo_name): |
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
122 """PUT /repos/repo_name: Update an existing item""" |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
123 # Forms posted to this method should contain a hidden field: |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
124 # <input type="hidden" name="_method" value="PUT" /> |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
125 # Or using helpers: |
312
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
126 # h.form(url('repo', repo_name=ID), |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
127 # method='put') |
312
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
128 # url('repo', repo_name=ID) |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
129 repo_model = RepoModel() |
382
b0715a788432
Added new style error display,
Marcin Kuzminski <marcin@python-works.com>
parents:
339
diff
changeset
|
130 changed_name = repo_name |
b0715a788432
Added new style error display,
Marcin Kuzminski <marcin@python-works.com>
parents:
339
diff
changeset
|
131 _form = RepoForm(edit=True, old_data={'repo_name':repo_name})() |
b0715a788432
Added new style error display,
Marcin Kuzminski <marcin@python-works.com>
parents:
339
diff
changeset
|
132 |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
133 try: |
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
134 form_result = _form.to_python(dict(request.POST)) |
312
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
135 repo_model.update(repo_name, form_result) |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
136 invalidate_cache('cached_repo_list') |
331
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
312
diff
changeset
|
137 h.flash(_('Repository %s updated succesfully' % repo_name), |
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
312
diff
changeset
|
138 category='success') |
382
b0715a788432
Added new style error display,
Marcin Kuzminski <marcin@python-works.com>
parents:
339
diff
changeset
|
139 changed_name = form_result['repo_name'] |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
140 except formencode.Invalid as errors: |
312
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
141 c.repo_info = repo_model.get(repo_name) |
311
15e96b5a2685
autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents:
309
diff
changeset
|
142 c.users_array = repo_model.get_users_js() |
309
29370bb76fa6
first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents:
266
diff
changeset
|
143 errors.value.update({'user':c.repo_info.user.username}) |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
144 return htmlfill.render( |
382
b0715a788432
Added new style error display,
Marcin Kuzminski <marcin@python-works.com>
parents:
339
diff
changeset
|
145 render('admin/repos/repo_edit.html'), |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
146 defaults=errors.value, |
382
b0715a788432
Added new style error display,
Marcin Kuzminski <marcin@python-works.com>
parents:
339
diff
changeset
|
147 errors=errors.error_dict or {}, |
b0715a788432
Added new style error display,
Marcin Kuzminski <marcin@python-works.com>
parents:
339
diff
changeset
|
148 prefix_error=False, |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
149 encoding="UTF-8") |
382
b0715a788432
Added new style error display,
Marcin Kuzminski <marcin@python-works.com>
parents:
339
diff
changeset
|
150 |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
151 except Exception: |
382
b0715a788432
Added new style error display,
Marcin Kuzminski <marcin@python-works.com>
parents:
339
diff
changeset
|
152 log.error(traceback.format_exc()) |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
153 h.flash(_('error occured during update of repository %s') \ |
382
b0715a788432
Added new style error display,
Marcin Kuzminski <marcin@python-works.com>
parents:
339
diff
changeset
|
154 % repo_name, category='error') |
b0715a788432
Added new style error display,
Marcin Kuzminski <marcin@python-works.com>
parents:
339
diff
changeset
|
155 |
b0715a788432
Added new style error display,
Marcin Kuzminski <marcin@python-works.com>
parents:
339
diff
changeset
|
156 return redirect(url('edit_repo', repo_name=changed_name)) |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
157 |
412
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
158 @HasPermissionAllDecorator('hg.admin') |
312
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
159 def delete(self, repo_name): |
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
160 """DELETE /repos/repo_name: Delete an existing item""" |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
161 # Forms posted to this method should contain a hidden field: |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
162 # <input type="hidden" name="_method" value="DELETE" /> |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
163 # Or using helpers: |
312
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
164 # h.form(url('repo', repo_name=ID), |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
165 # method='delete') |
312
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
166 # url('repo', repo_name=ID) |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
167 |
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
168 repo_model = RepoModel() |
312
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
169 repo = repo_model.get(repo_name) |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
170 if not repo: |
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
171 h.flash(_('%s repository is not mapped to db perhaps' |
266
32d6c955218c
added check for repo created outside of hg app
Marcin Kuzminski <marcin@python-works.com>
parents:
265
diff
changeset
|
172 ' it was moved or renamed from the filesystem' |
32d6c955218c
added check for repo created outside of hg app
Marcin Kuzminski <marcin@python-works.com>
parents:
265
diff
changeset
|
173 ' please run the application again' |
331
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
312
diff
changeset
|
174 ' in order to rescan repositories') % repo_name, |
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
312
diff
changeset
|
175 category='error') |
140
b5e59e2b5cfe
moved cache invalidating to utils, as seperate function. Implemented invalidating in
Marcin Kuzminski <marcin@python-works.com>
parents:
127
diff
changeset
|
176 |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
177 return redirect(url('repos')) |
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
178 try: |
597
b75b77ef649d
renamed hg_app to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
596
diff
changeset
|
179 action_logger(self.rhodecode_user, 'admin_deleted_repo', |
585
48be953851fc
extended user logs to create/delete/fork repositories for auditing
Marcin Kuzminski <marcin@python-works.com>
parents:
453
diff
changeset
|
180 repo_name, '', self.sa) |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
181 repo_model.delete(repo) |
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
182 invalidate_cache('cached_repo_list') |
312
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
183 h.flash(_('deleted repository %s') % repo_name, category='success') |
585
48be953851fc
extended user logs to create/delete/fork repositories for auditing
Marcin Kuzminski <marcin@python-works.com>
parents:
453
diff
changeset
|
184 |
48be953851fc
extended user logs to create/delete/fork repositories for auditing
Marcin Kuzminski <marcin@python-works.com>
parents:
453
diff
changeset
|
185 except Exception, e: |
48be953851fc
extended user logs to create/delete/fork repositories for auditing
Marcin Kuzminski <marcin@python-works.com>
parents:
453
diff
changeset
|
186 log.error(traceback.format_exc()) |
312
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
187 h.flash(_('An error occured during deletion of %s') % repo_name, |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
188 category='error') |
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
189 |
58
8fb1abd4178a
Added hg model,implemented removal of repos, added HgModel for fetching repos(with generator)
Marcin Kuzminski <marcin@python-blog.com>
parents:
52
diff
changeset
|
190 return redirect(url('repos')) |
412
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
191 |
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
192 @HasPermissionAllDecorator('hg.admin') |
312
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
193 def delete_perm_user(self, repo_name): |
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
194 """ |
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
195 DELETE an existing repository permission user |
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
196 @param repo_name: |
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
197 """ |
220 | 198 |
312
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
199 try: |
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
200 repo_model = RepoModel() |
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
201 repo_model.delete_perm_user(request.POST, repo_name) |
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
202 except Exception as e: |
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
203 h.flash(_('An error occured during deletion of repository user'), |
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
204 category='error') |
391
ec7b76d4bda4
Added initial query skipp when seting up the app.
Marcin Kuzminski <marcin@python-works.com>
parents:
383
diff
changeset
|
205 raise HTTPInternalServerError() |
412
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
206 |
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
207 @HasPermissionAllDecorator('hg.admin') |
312
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
208 def show(self, repo_name, format='html'): |
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
209 """GET /repos/repo_name: Show a specific item""" |
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
210 # url('repo', repo_name=ID) |
412
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
211 |
ca54622e39a1
Added separate create repository views for non administrative users.
Marcin Kuzminski <marcin@python-works.com>
parents:
408
diff
changeset
|
212 @HasPermissionAllDecorator('hg.admin') |
312
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
213 def edit(self, repo_name, format='html'): |
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
214 """GET /repos/repo_name/edit: Form to edit an existing item""" |
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
215 # url('edit_repo', repo_name=ID) |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
216 repo_model = RepoModel() |
312
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
217 c.repo_info = repo = repo_model.get(repo_name) |
266
32d6c955218c
added check for repo created outside of hg app
Marcin Kuzminski <marcin@python-works.com>
parents:
265
diff
changeset
|
218 if not repo: |
32d6c955218c
added check for repo created outside of hg app
Marcin Kuzminski <marcin@python-works.com>
parents:
265
diff
changeset
|
219 h.flash(_('%s repository is not mapped to db perhaps' |
32d6c955218c
added check for repo created outside of hg app
Marcin Kuzminski <marcin@python-works.com>
parents:
265
diff
changeset
|
220 ' it was created or renamed from the filesystem' |
32d6c955218c
added check for repo created outside of hg app
Marcin Kuzminski <marcin@python-works.com>
parents:
265
diff
changeset
|
221 ' please run the application again' |
331
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
312
diff
changeset
|
222 ' in order to rescan repositories') % repo_name, |
fdf9f6ee5217
Implemented permissions into hg app, secured admin controllers, templates and repository specific controllers
Marcin Kuzminski <marcin@python-works.com>
parents:
312
diff
changeset
|
223 category='error') |
266
32d6c955218c
added check for repo created outside of hg app
Marcin Kuzminski <marcin@python-works.com>
parents:
265
diff
changeset
|
224 |
32d6c955218c
added check for repo created outside of hg app
Marcin Kuzminski <marcin@python-works.com>
parents:
265
diff
changeset
|
225 return redirect(url('repos')) |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
226 defaults = c.repo_info.__dict__ |
408
7fbf81447c6c
Fixes #18, removing user, who owns some repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
401
diff
changeset
|
227 if c.repo_info.user: |
7fbf81447c6c
Fixes #18, removing user, who owns some repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
401
diff
changeset
|
228 defaults.update({'user':c.repo_info.user.username}) |
7fbf81447c6c
Fixes #18, removing user, who owns some repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
401
diff
changeset
|
229 else: |
7fbf81447c6c
Fixes #18, removing user, who owns some repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
401
diff
changeset
|
230 replacement_user = self.sa.query(User)\ |
7fbf81447c6c
Fixes #18, removing user, who owns some repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
401
diff
changeset
|
231 .filter(User.admin == True).first().username |
7fbf81447c6c
Fixes #18, removing user, who owns some repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
401
diff
changeset
|
232 defaults.update({'user':replacement_user}) |
7fbf81447c6c
Fixes #18, removing user, who owns some repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
401
diff
changeset
|
233 |
311
15e96b5a2685
autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents:
309
diff
changeset
|
234 c.users_array = repo_model.get_users_js() |
15e96b5a2685
autocomplete for repository managment of users
Marcin Kuzminski <marcin@python-works.com>
parents:
309
diff
changeset
|
235 |
432
f5c1eec9f376
rename repo2perm into repo_to_perm
Marcin Kuzminski <marcin@python-works.com>
parents:
412
diff
changeset
|
236 for p in c.repo_info.repo_to_perm: |
309
29370bb76fa6
first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents:
266
diff
changeset
|
237 defaults.update({'perm_%s' % p.user.username: |
29370bb76fa6
first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents:
266
diff
changeset
|
238 p.permission.permission_name}) |
312
d303aacb3349
repos crud controllers - change id into repo_name for compatability, added ajax repo perm user function variuos html fixes, permissions forms and managment fixes.
Marcin Kuzminski <marcin@python-works.com>
parents:
311
diff
changeset
|
239 |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
240 return htmlfill.render( |
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
241 render('admin/repos/repo_edit.html'), |
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
242 defaults=defaults, |
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
243 encoding="UTF-8", |
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
244 force_defaults=False |
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
252
diff
changeset
|
245 ) |