Skip to content

Commit

Permalink
* Fix domain admin account edit and delete domains list
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Colin Kissa <andrew@topdog.za.net>
  • Loading branch information
akissa committed Apr 18, 2013
1 parent e9a497b commit 40ef61e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion baruwa/controllers/accounts.py
Expand Up @@ -633,12 +633,19 @@ def edit(self, userid):

c.form = EditUserForm(request.POST, user, csrf_context=session)
c.form.domains.query = Session.query(Domain)
if c.user.is_domain_admin:
c.form.domains.query = Session.query(Domain).join(dom_owns,
(oas, dom_owns.c.organization_id ==
oas.c.organization_id))\
.filter(oas.c.user_id == c.user.id)

if user.account_type != 3 or c.user.is_peleb:
del c.form.domains
if c.user.is_peleb:
del c.form.username
del c.form.email
del c.form.active

if request.POST and c.form.validate():
update = False
kwd = dict(userid=userid)
Expand Down Expand Up @@ -683,7 +690,8 @@ def delete(self, userid):
abort(404)

c.form = EditUserForm(request.POST, user, csrf_context=session)
c.form.domains.query = Session.query(Domain)
del c.form.domains

if request.POST and c.form.validate():
username = user.username
Session.delete(user)
Expand Down

0 comments on commit 40ef61e

Please sign in to comment.