Show More
@@ -0,0 +1,79 b'' | |||||
|
1 | ## -*- coding: utf-8 -*- | |||
|
2 | <%inherit file="/base/base.html"/> | |||
|
3 | ||||
|
4 | <%def name="title()"> | |||
|
5 | ${_('User administration')} | |||
|
6 | </%def> | |||
|
7 | ||||
|
8 | <%def name="breadcrumbs_links()"> | |||
|
9 | ${_('My Account')} | |||
|
10 | </%def> | |||
|
11 | ||||
|
12 | <%def name="page_nav()"> | |||
|
13 | ${self.menu('admin')} | |||
|
14 | </%def> | |||
|
15 | ||||
|
16 | <%def name="main()"> | |||
|
17 | <div class="box"> | |||
|
18 | <!-- box / title --> | |||
|
19 | <div class="title"> | |||
|
20 | ${self.breadcrumbs()} | |||
|
21 | </div> | |||
|
22 | <!-- end box / title --> | |||
|
23 | ${h.form(url('admin_settings_my_account_update'),method='put')} | |||
|
24 | <div class="form"> | |||
|
25 | <!-- fields --> | |||
|
26 | <div class="fields"> | |||
|
27 | <div class="field"> | |||
|
28 | <div class="label"> | |||
|
29 | <label for="username">${_('Username')}:</label> | |||
|
30 | </div> | |||
|
31 | <div class="input"> | |||
|
32 | ${h.text('username')} | |||
|
33 | </div> | |||
|
34 | </div> | |||
|
35 | ||||
|
36 | <div class="field"> | |||
|
37 | <div class="label"> | |||
|
38 | <label for="new_password">${_('New password')}:</label> | |||
|
39 | </div> | |||
|
40 | <div class="input"> | |||
|
41 | ${h.password('new_password')} | |||
|
42 | </div> | |||
|
43 | </div> | |||
|
44 | ||||
|
45 | <div class="field"> | |||
|
46 | <div class="label"> | |||
|
47 | <label for="name">${_('Name')}:</label> | |||
|
48 | </div> | |||
|
49 | <div class="input"> | |||
|
50 | ${h.text('name')} | |||
|
51 | </div> | |||
|
52 | </div> | |||
|
53 | ||||
|
54 | <div class="field"> | |||
|
55 | <div class="label"> | |||
|
56 | <label for="lastname">${_('Lastname')}:</label> | |||
|
57 | </div> | |||
|
58 | <div class="input"> | |||
|
59 | ${h.text('lastname')} | |||
|
60 | </div> | |||
|
61 | </div> | |||
|
62 | ||||
|
63 | <div class="field"> | |||
|
64 | <div class="label"> | |||
|
65 | <label for="email">${_('Email')}:</label> | |||
|
66 | </div> | |||
|
67 | <div class="input"> | |||
|
68 | ${h.text('email')} | |||
|
69 | </div> | |||
|
70 | </div> | |||
|
71 | ||||
|
72 | <div class="buttons"> | |||
|
73 | ${h.submit('save','save',class_="ui-button ui-widget ui-state-default ui-corner-all")} | |||
|
74 | </div> | |||
|
75 | </div> | |||
|
76 | </div> | |||
|
77 | ${h.end_form()} | |||
|
78 | </div> | |||
|
79 | </%def> No newline at end of file |
@@ -4,6 +4,7 b' The more specific and detailed routes sh' | |||||
4 | may take precedent over the more generic routes. For more information |
|
4 | may take precedent over the more generic routes. For more information | |
5 | refer to the routes manual at http://routes.groovie.org/docs/ |
|
5 | refer to the routes manual at http://routes.groovie.org/docs/ | |
6 | """ |
|
6 | """ | |
|
7 | from __future__ import with_statement | |||
7 | from routes import Mapper |
|
8 | from routes import Mapper | |
8 | from pylons_app.lib.utils import check_repo_fast as cr |
|
9 | from pylons_app.lib.utils import check_repo_fast as cr | |
9 |
|
10 | |||
@@ -31,7 +32,7 b' def make_map(config):' | |||||
31 | repo_name = match_dict.get('repo_name') |
|
32 | repo_name = match_dict.get('repo_name') | |
32 | return not cr(repo_name, config['base_path']) |
|
33 | return not cr(repo_name, config['base_path']) | |
33 |
|
34 | |||
34 | #REST routes |
|
35 | #REST REPO MAP | |
35 | with map.submapper(path_prefix='/_admin', controller='admin/repos') as m: |
|
36 | with map.submapper(path_prefix='/_admin', controller='admin/repos') as m: | |
36 | m.connect("repos", "/repos", |
|
37 | m.connect("repos", "/repos", | |
37 | action="create", conditions=dict(method=["POST"])) |
|
38 | action="create", conditions=dict(method=["POST"])) | |
@@ -69,7 +70,36 b' def make_map(config):' | |||||
69 |
|
70 | |||
70 | map.resource('user', 'users', controller='admin/users', path_prefix='/_admin') |
|
71 | map.resource('user', 'users', controller='admin/users', path_prefix='/_admin') | |
71 | map.resource('permission', 'permissions', controller='admin/permissions', path_prefix='/_admin') |
|
72 | map.resource('permission', 'permissions', controller='admin/permissions', path_prefix='/_admin') | |
72 | map.resource('setting', 'settings', controller='admin/settings', path_prefix='/_admin', name_prefix='admin_') |
|
73 | ||
|
74 | #map.resource('setting', 'settings', controller='admin/settings', path_prefix='/_admin', name_prefix='admin_') | |||
|
75 | #REST SETTINGS MAP | |||
|
76 | with map.submapper(path_prefix='/_admin', controller='admin/settings') as m: | |||
|
77 | m.connect("admin_settings", "/settings", | |||
|
78 | action="create", conditions=dict(method=["POST"])) | |||
|
79 | m.connect("admin_settings", "/settings", | |||
|
80 | action="index", conditions=dict(method=["GET"])) | |||
|
81 | m.connect("admin_formatted_settings", "/settings.{format}", | |||
|
82 | action="index", conditions=dict(method=["GET"])) | |||
|
83 | m.connect("admin_new_setting", "/settings/new", | |||
|
84 | action="new", conditions=dict(method=["GET"])) | |||
|
85 | m.connect("admin_formatted_new_setting", "/settings/new.{format}", | |||
|
86 | action="new", conditions=dict(method=["GET"])) | |||
|
87 | m.connect("/settings/{setting_id}", | |||
|
88 | action="update", conditions=dict(method=["PUT"])) | |||
|
89 | m.connect("/settings/{setting_id}", | |||
|
90 | action="delete", conditions=dict(method=["DELETE"])) | |||
|
91 | m.connect("admin_edit_setting", "/settings/{setting_id}/edit", | |||
|
92 | action="edit", conditions=dict(method=["GET"])) | |||
|
93 | m.connect("admin_formatted_edit_setting", "/settings/{setting_id}.{format}/edit", | |||
|
94 | action="edit", conditions=dict(method=["GET"])) | |||
|
95 | m.connect("admin_setting", "/settings/{setting_id}", | |||
|
96 | action="show", conditions=dict(method=["GET"])) | |||
|
97 | m.connect("admin_formatted_setting", "/settings/{setting_id}.{format}", | |||
|
98 | action="show", conditions=dict(method=["GET"])) | |||
|
99 | m.connect("admin_settings_my_account", "/my_account", | |||
|
100 | action="my_account", conditions=dict(method=["GET"])) | |||
|
101 | m.connect("admin_settings_my_account_update", "/my_account_update", | |||
|
102 | action="my_account_update", conditions=dict(method=["PUT"])) | |||
73 |
|
103 | |||
74 | #ADMIN |
|
104 | #ADMIN | |
75 | with map.submapper(path_prefix='/_admin', controller='admin/admin') as m: |
|
105 | with map.submapper(path_prefix='/_admin', controller='admin/admin') as m: |
@@ -2,6 +2,7 b'' | |||||
2 | # encoding: utf-8 |
|
2 | # encoding: utf-8 | |
3 | # repos controller for pylons |
|
3 | # repos controller for pylons | |
4 | # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
|
4 | # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |
|
5 | # | |||
5 | # This program is free software; you can redistribute it and/or |
|
6 | # This program is free software; you can redistribute it and/or | |
6 | # modify it under the terms of the GNU General Public License |
|
7 | # modify it under the terms of the GNU General Public License | |
7 | # as published by the Free Software Foundation; version 2 |
|
8 | # as published by the Free Software Foundation; version 2 |
@@ -52,12 +52,13 b' class SettingsController(BaseController)' | |||||
52 |
|
52 | |||
53 |
|
53 | |||
54 | @LoginRequired() |
|
54 | @LoginRequired() | |
55 | #@HasPermissionAllDecorator('hg.admin') |
|
|||
56 | def __before__(self): |
|
55 | def __before__(self): | |
57 | c.admin_user = session.get('admin_user') |
|
56 | c.admin_user = session.get('admin_user') | |
58 | c.admin_username = session.get('admin_username') |
|
57 | c.admin_username = session.get('admin_username') | |
59 | super(SettingsController, self).__before__() |
|
58 | super(SettingsController, self).__before__() | |
60 |
|
|
59 | ||
|
60 | ||||
|
61 | @HasPermissionAllDecorator('hg.admin') | |||
61 | def index(self, format='html'): |
|
62 | def index(self, format='html'): | |
62 | """GET /admin/settings: All items in the collection""" |
|
63 | """GET /admin/settings: All items in the collection""" | |
63 | # url('admin_settings') |
|
64 | # url('admin_settings') | |
@@ -71,23 +72,26 b' class SettingsController(BaseController)' | |||||
71 | force_defaults=False |
|
72 | force_defaults=False | |
72 | ) |
|
73 | ) | |
73 |
|
74 | |||
|
75 | @HasPermissionAllDecorator('hg.admin') | |||
74 | def create(self): |
|
76 | def create(self): | |
75 | """POST /admin/settings: Create a new item""" |
|
77 | """POST /admin/settings: Create a new item""" | |
76 | # url('admin_settings') |
|
78 | # url('admin_settings') | |
77 |
|
79 | |||
|
80 | @HasPermissionAllDecorator('hg.admin') | |||
78 | def new(self, format='html'): |
|
81 | def new(self, format='html'): | |
79 | """GET /admin/settings/new: Form to create a new item""" |
|
82 | """GET /admin/settings/new: Form to create a new item""" | |
80 | # url('admin_new_setting') |
|
83 | # url('admin_new_setting') | |
81 |
|
84 | |||
82 | def update(self, id): |
|
85 | @HasPermissionAllDecorator('hg.admin') | |
83 | """PUT /admin/settings/id: Update an existing item""" |
|
86 | def update(self, setting_id): | |
|
87 | """PUT /admin/settings/setting_id: Update an existing item""" | |||
84 | # Forms posted to this method should contain a hidden field: |
|
88 | # Forms posted to this method should contain a hidden field: | |
85 | # <input type="hidden" name="_method" value="PUT" /> |
|
89 | # <input type="hidden" name="_method" value="PUT" /> | |
86 | # Or using helpers: |
|
90 | # Or using helpers: | |
87 | # h.form(url('admin_setting', id=ID), |
|
91 | # h.form(url('admin_setting', setting_id=ID), | |
88 | # method='put') |
|
92 | # method='put') | |
89 | # url('admin_setting', id=ID) |
|
93 | # url('admin_setting', setting_id=ID) | |
90 | if id == 'mapping': |
|
94 | if setting_id == 'mapping': | |
91 | rm_obsolete = request.POST.get('destroy', False) |
|
95 | rm_obsolete = request.POST.get('destroy', False) | |
92 | log.debug('Rescanning directories with destroy=%s', rm_obsolete) |
|
96 | log.debug('Rescanning directories with destroy=%s', rm_obsolete) | |
93 |
|
97 | |||
@@ -96,7 +100,7 b' class SettingsController(BaseController)' | |||||
96 | invalidate_cache('cached_repo_list') |
|
100 | invalidate_cache('cached_repo_list') | |
97 | h.flash(_('Repositories sucessfully rescanned'), category='success') |
|
101 | h.flash(_('Repositories sucessfully rescanned'), category='success') | |
98 |
|
102 | |||
99 | if id == 'global': |
|
103 | if setting_id == 'global': | |
100 |
|
104 | |||
101 | application_form = ApplicationSettingsForm()() |
|
105 | application_form = ApplicationSettingsForm()() | |
102 | try: |
|
106 | try: | |
@@ -132,20 +136,77 b' class SettingsController(BaseController)' | |||||
132 | encoding="UTF-8") |
|
136 | encoding="UTF-8") | |
133 |
|
137 | |||
134 | return redirect(url('admin_settings')) |
|
138 | return redirect(url('admin_settings')) | |
135 |
|
139 | |||
136 | def delete(self, id): |
|
140 | @HasPermissionAllDecorator('hg.admin') | |
137 | """DELETE /admin/settings/id: Delete an existing item""" |
|
141 | def delete(self, setting_id): | |
|
142 | """DELETE /admin/settings/setting_id: Delete an existing item""" | |||
138 | # Forms posted to this method should contain a hidden field: |
|
143 | # Forms posted to this method should contain a hidden field: | |
139 | # <input type="hidden" name="_method" value="DELETE" /> |
|
144 | # <input type="hidden" name="_method" value="DELETE" /> | |
140 | # Or using helpers: |
|
145 | # Or using helpers: | |
141 | # h.form(url('admin_setting', id=ID), |
|
146 | # h.form(url('admin_setting', setting_id=ID), | |
142 | # method='delete') |
|
147 | # method='delete') | |
143 | # url('admin_setting', id=ID) |
|
148 | # url('admin_setting', setting_id=ID) | |
|
149 | ||||
|
150 | @HasPermissionAllDecorator('hg.admin') | |||
|
151 | def show(self, setting_id, format='html'): | |||
|
152 | """GET /admin/settings/setting_id: Show a specific item""" | |||
|
153 | # url('admin_setting', setting_id=ID) | |||
|
154 | ||||
|
155 | @HasPermissionAllDecorator('hg.admin') | |||
|
156 | def edit(self, setting_id, format='html'): | |||
|
157 | """GET /admin/settings/setting_id/edit: Form to edit an existing item""" | |||
|
158 | # url('admin_edit_setting', setting_id=ID) | |||
|
159 | ||||
|
160 | ||||
|
161 | def my_account(self): | |||
|
162 | """ | |||
|
163 | GET /_admin/my_account Displays info about my account | |||
|
164 | """ | |||
|
165 | # url('admin_settings_my_account') | |||
|
166 | c.user = self.sa.query(User).get(c.hg_app_user.user_id) | |||
|
167 | if c.user.username == 'default': | |||
|
168 | h.flash(_("You can't edit this user since it's" | |||
|
169 | " crucial for entire application"), category='warning') | |||
|
170 | return redirect(url('users')) | |||
|
171 | ||||
|
172 | defaults = c.user.__dict__ | |||
|
173 | return htmlfill.render( | |||
|
174 | render('admin/users/user_edit_my_account.html'), | |||
|
175 | defaults=defaults, | |||
|
176 | encoding="UTF-8", | |||
|
177 | force_defaults=False | |||
|
178 | ) | |||
144 |
|
179 | |||
145 | def show(self, id, format='html'): |
|
180 | def my_account_update(self): | |
146 | """GET /admin/settings/id: Show a specific item""" |
|
181 | """PUT /_admin/my_account_update: Update an existing item""" | |
147 | # url('admin_setting', id=ID) |
|
182 | # Forms posted to this method should contain a hidden field: | |
|
183 | # <input type="hidden" name="_method" value="PUT" /> | |||
|
184 | # Or using helpers: | |||
|
185 | # h.form(url('admin_settings_my_account_update'), | |||
|
186 | # method='put') | |||
|
187 | # url('admin_settings_my_account_update', id=ID) | |||
|
188 | user_model = UserModel() | |||
|
189 | uid = c.hg_app_user.user_id | |||
|
190 | _form = UserForm(edit=True, old_data={'user_id':uid})() | |||
|
191 | form_result = {} | |||
|
192 | try: | |||
|
193 | form_result = _form.to_python(dict(request.POST)) | |||
|
194 | user_model.update_my_account(uid, form_result) | |||
|
195 | h.flash(_('Your account was updated succesfully'), category='success') | |||
|
196 | ||||
|
197 | except formencode.Invalid as errors: | |||
|
198 | #c.user = self.sa.query(User).get(c.hg_app_user.user_id) | |||
|
199 | return htmlfill.render( | |||
|
200 | render('admin/users/user_edit_my_account.html'), | |||
|
201 | defaults=errors.value, | |||
|
202 | errors=errors.error_dict or {}, | |||
|
203 | prefix_error=False, | |||
|
204 | encoding="UTF-8") | |||
|
205 | except Exception: | |||
|
206 | log.error(traceback.format_exc()) | |||
|
207 | h.flash(_('error occured during update of user %s') \ | |||
|
208 | % form_result.get('username'), category='error') | |||
|
209 | ||||
|
210 | return redirect(url('my_account')) | |||
|
211 | ||||
148 |
|
212 | |||
149 | def edit(self, id, format='html'): |
|
|||
150 | """GET /admin/settings/id/edit: Form to edit an existing item""" |
|
|||
151 | # url('admin_edit_setting', id=ID) |
|
@@ -17,6 +17,12 b'' | |||||
17 | # along with this program; if not, write to the Free Software |
|
17 | # along with this program; if not, write to the Free Software | |
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
19 | # MA 02110-1301, USA. |
|
19 | # MA 02110-1301, USA. | |
|
20 | """ | |||
|
21 | Created on April 4, 2010 | |||
|
22 | users controller for pylons | |||
|
23 | @author: marcink | |||
|
24 | """ | |||
|
25 | ||||
20 | from formencode import htmlfill |
|
26 | from formencode import htmlfill | |
21 | from pylons import request, session, tmpl_context as c, url |
|
27 | from pylons import request, session, tmpl_context as c, url | |
22 | from pylons.controllers.util import abort, redirect |
|
28 | from pylons.controllers.util import abort, redirect | |
@@ -30,11 +36,7 b' from pylons_app.model.user_model import ' | |||||
30 | import formencode |
|
36 | import formencode | |
31 | import logging |
|
37 | import logging | |
32 | import traceback |
|
38 | import traceback | |
33 | """ |
|
39 | ||
34 | Created on April 4, 2010 |
|
|||
35 | users controller for pylons |
|
|||
36 | @author: marcink |
|
|||
37 | """ |
|
|||
38 |
|
40 | |||
39 | log = logging.getLogger(__name__) |
|
41 | log = logging.getLogger(__name__) | |
40 |
|
42 |
@@ -104,7 +104,23 b' def set_available_permissions(config):' | |||||
104 |
|
104 | |||
105 | def set_base_path(config): |
|
105 | def set_base_path(config): | |
106 | config['base_path'] = config['pylons.app_globals'].base_path |
|
106 | config['base_path'] = config['pylons.app_globals'].base_path | |
107 |
|
107 | |||
|
108 | def fill_data(user): | |||
|
109 | """ | |||
|
110 | Fills user data with those from database | |||
|
111 | @param user: | |||
|
112 | """ | |||
|
113 | sa = meta.Session | |||
|
114 | dbuser = sa.query(User).get(user.user_id) | |||
|
115 | ||||
|
116 | user.username = dbuser.username | |||
|
117 | user.is_admin = dbuser.admin | |||
|
118 | user.name = dbuser.name | |||
|
119 | user.lastname = dbuser.lastname | |||
|
120 | ||||
|
121 | meta.Session.remove() | |||
|
122 | return user | |||
|
123 | ||||
108 | def fill_perms(user): |
|
124 | def fill_perms(user): | |
109 | """ |
|
125 | """ | |
110 | Fills user permission attribute with permissions taken from database |
|
126 | Fills user permission attribute with permissions taken from database | |
@@ -113,6 +129,7 b' def fill_perms(user):' | |||||
113 |
|
129 | |||
114 | sa = meta.Session |
|
130 | sa = meta.Session | |
115 | user.permissions['repositories'] = {} |
|
131 | user.permissions['repositories'] = {} | |
|
132 | user.permissions['global'] = set() | |||
116 |
|
133 | |||
117 | #first fetch default permissions |
|
134 | #first fetch default permissions | |
118 | default_perms = sa.query(Repo2Perm, Repository, Permission)\ |
|
135 | default_perms = sa.query(Repo2Perm, Repository, Permission)\ | |
@@ -122,14 +139,14 b' def fill_perms(user):' | |||||
122 | 'default').one().user_id).all() |
|
139 | 'default').one().user_id).all() | |
123 |
|
140 | |||
124 | if user.is_admin: |
|
141 | if user.is_admin: | |
125 |
user.permissions['global'] |
|
142 | user.permissions['global'].add('hg.admin') | |
126 | #admin have all rights full |
|
143 | #admin have all rights full | |
127 | for perm in default_perms: |
|
144 | for perm in default_perms: | |
128 | p = 'repository.admin' |
|
145 | p = 'repository.admin' | |
129 | user.permissions['repositories'][perm.Repo2Perm.repository.repo_name] = p |
|
146 | user.permissions['repositories'][perm.Repo2Perm.repository.repo_name] = p | |
130 |
|
147 | |||
131 | else: |
|
148 | else: | |
132 |
user.permissions['global'] |
|
149 | user.permissions['global'].add('') | |
133 | for perm in default_perms: |
|
150 | for perm in default_perms: | |
134 | if perm.Repository.private: |
|
151 | if perm.Repository.private: | |
135 | #disable defaults for private repos, |
|
152 | #disable defaults for private repos, | |
@@ -164,8 +181,8 b' def get_user(session):' | |||||
164 | @param session: |
|
181 | @param session: | |
165 | """ |
|
182 | """ | |
166 | user = session.get('hg_app_user', AuthUser()) |
|
183 | user = session.get('hg_app_user', AuthUser()) | |
167 |
|
||||
168 | if user.is_authenticated: |
|
184 | if user.is_authenticated: | |
|
185 | user = fill_data(user) | |||
169 | user = fill_perms(user) |
|
186 | user = fill_perms(user) | |
170 | session['hg_app_user'] = user |
|
187 | session['hg_app_user'] = user | |
171 | session.save() |
|
188 | session.save() |
@@ -177,8 +177,9 b' class DbManage(object):' | |||||
177 | ('repository.read', 'Repository read access'), |
|
177 | ('repository.read', 'Repository read access'), | |
178 | ('repository.write', 'Repository write access'), |
|
178 | ('repository.write', 'Repository write access'), | |
179 | ('repository.admin', 'Repository admin access'), |
|
179 | ('repository.admin', 'Repository admin access'), | |
|
180 | ('repository.create', 'Repository create'), | |||
180 | ('hg.admin', 'Hg Administrator'), |
|
181 | ('hg.admin', 'Hg Administrator'), | |
181 |
|
|
182 | ] | |
182 |
|
183 | |||
183 | for p in perms: |
|
184 | for p in perms: | |
184 | new_perm = Permission() |
|
185 | new_perm = Permission() |
@@ -68,9 +68,9 b' class UserModel(object):' | |||||
68 | self.sa.rollback() |
|
68 | self.sa.rollback() | |
69 | raise |
|
69 | raise | |
70 |
|
70 | |||
71 | def update(self, id, form_data): |
|
71 | def update(self, uid, form_data): | |
72 | try: |
|
72 | try: | |
73 | new_user = self.sa.query(User).get(id) |
|
73 | new_user = self.sa.query(User).get(uid) | |
74 | if new_user.username == 'default': |
|
74 | if new_user.username == 'default': | |
75 | raise DefaultUserException( |
|
75 | raise DefaultUserException( | |
76 | _("You can't Edit this user since it's" |
|
76 | _("You can't Edit this user since it's" | |
@@ -87,7 +87,28 b' class UserModel(object):' | |||||
87 | log.error(e) |
|
87 | log.error(e) | |
88 | self.sa.rollback() |
|
88 | self.sa.rollback() | |
89 | raise |
|
89 | raise | |
90 |
|
90 | |||
|
91 | def update_my_account(self, uid, form_data): | |||
|
92 | try: | |||
|
93 | new_user = self.sa.query(User).get(uid) | |||
|
94 | if new_user.username == 'default': | |||
|
95 | raise DefaultUserException( | |||
|
96 | _("You can't Edit this user since it's" | |||
|
97 | " crucial for entire application")) | |||
|
98 | for k, v in form_data.items(): | |||
|
99 | if k == 'new_password' and v != '': | |||
|
100 | new_user.password = v | |||
|
101 | else: | |||
|
102 | if k not in ['admin', 'active']: | |||
|
103 | setattr(new_user, k, v) | |||
|
104 | ||||
|
105 | self.sa.add(new_user) | |||
|
106 | self.sa.commit() | |||
|
107 | except Exception as e: | |||
|
108 | log.error(e) | |||
|
109 | self.sa.rollback() | |||
|
110 | raise | |||
|
111 | ||||
91 | def delete(self, id): |
|
112 | def delete(self, id): | |
92 |
|
113 | |||
93 | try: |
|
114 | try: |
@@ -23,7 +23,7 b'' | |||||
23 | </div> |
|
23 | </div> | |
24 | <!-- end box / title --> |
|
24 | <!-- end box / title --> | |
25 |
|
25 | |||
26 | ${h.form(url('admin_setting', id='mapping'),method='put')} |
|
26 | ${h.form(url('admin_setting', setting_id='mapping'),method='put')} | |
27 | <div class="form"> |
|
27 | <div class="form"> | |
28 | <!-- fields --> |
|
28 | <!-- fields --> | |
29 | <h3>${_('Remap and rescan repositories')}</h3> |
|
29 | <h3>${_('Remap and rescan repositories')}</h3> | |
@@ -49,7 +49,7 b'' | |||||
49 | </div> |
|
49 | </div> | |
50 | ${h.end_form()} |
|
50 | ${h.end_form()} | |
51 |
|
51 | |||
52 | ${h.form(url('admin_setting', id='global'),method='put')} |
|
52 | ${h.form(url('admin_setting', setting_id='global'),method='put')} | |
53 | <div class="form"> |
|
53 | <div class="form"> | |
54 | <!-- fields --> |
|
54 | <!-- fields --> | |
55 | <h3>${_('Global application settings')}</h3> |
|
55 | <h3>${_('Global application settings')}</h3> |
@@ -17,7 +17,7 b'' | |||||
17 | <!-- user --> |
|
17 | <!-- user --> | |
18 | <ul id="logged-user"> |
|
18 | <ul id="logged-user"> | |
19 | <li class="first"> |
|
19 | <li class="first"> | |
20 |
${h.link_to('%s %s (%s)'%(c.hg_app_user.name,c.hg_app_user.lastname,c.hg_app_user.username),h.url(' |
|
20 | ${h.link_to('%s %s (%s)'%(c.hg_app_user.name,c.hg_app_user.lastname,c.hg_app_user.username),h.url('admin_settings_my_account'))} | |
21 | </li> |
|
21 | </li> | |
22 | <li class="last highlight">${h.link_to(u'Logout',h.url('logout_home'))}</li> |
|
22 | <li class="last highlight">${h.link_to(u'Logout',h.url('logout_home'))}</li> | |
23 | </ul> |
|
23 | </ul> |
@@ -27,6 +27,13 b'' | |||||
27 | <!-- box / title --> |
|
27 | <!-- box / title --> | |
28 | <div class="title"> |
|
28 | <div class="title"> | |
29 | <h5>${_('Dashboard')}</h5> |
|
29 | <h5>${_('Dashboard')}</h5> | |
|
30 | ##%if h.HasPermissionAll('repository.create')(): | |||
|
31 | <ul class="links"> | |||
|
32 | <li> | |||
|
33 | <span>${h.link_to(u'ADD NEW REPO',h.url('new_repo'),class_="add_icon")}</span> | |||
|
34 | </li> | |||
|
35 | </ul> | |||
|
36 | ##%endif | |||
30 | </div> |
|
37 | </div> | |
31 | <!-- end box / title --> |
|
38 | <!-- end box / title --> | |
32 | <div class="table"> |
|
39 | <div class="table"> |
General Comments 0
You need to be logged in to leave comments.
Login now