Skip to content
Browse files

fixed is_admin check on account lookup

  • Loading branch information...
1 parent 9867dc4 commit b43b503661ce1f7182f9f7ff3926b2de3d277f3d @spasovski spasovski committed Jun 25, 2012
View
4 mkt/acct_lookup/helpers.py
@@ -15,10 +15,10 @@ def format_currencies(context, currencies):
# page_type is used for setting the link 'sel' class (activity/purchases)
@register.function
-def user_header(account, title, page_type=''):
+def user_header(account, title, is_admin=False, page_type=''):
t = env.get_template('acct_lookup/helpers/user_header.html')
return jinja2.Markup(t.render(account=account, title=title,
- page_type=page_type))
+ is_admin=is_admin, page_type=page_type))
# page_type is used for setting the link 'sel' class
View
2 mkt/acct_lookup/templates/acct_lookup/helpers/user_header.html
@@ -27,7 +27,7 @@
</a>
</li>
{% if is_admin %}
- <li>
+ <li class="edit">
<a href="{{ url('users.admin_edit', account.id) }}">
{{ _('Edit Account') }}
</a>
View
3 mkt/acct_lookup/templates/acct_lookup/user_activity.html
@@ -7,7 +7,8 @@
{% include 'acct_lookup/includes/user_search.html' %}
<section class="island c">
- {{ user_header(account, _('Account Activity results for'), 'activity') }}
+ {{ user_header(account, _('Account Activity results for'), is_admin,
+ 'activity') }}
<section id="activity-info">
<h2>{{ _('Account Updates') }}</h2>
View
2 mkt/acct_lookup/templates/acct_lookup/user_purchases.html
@@ -7,7 +7,7 @@
{% include 'acct_lookup/includes/user_search.html' %}
<section class="island c">
- {{ user_header(account, _('Purchase results for'), 'purchases') }}
+ {{ user_header(account, _('Purchase results for'), is_admin, 'purchases') }}
{% include 'account/includes/purchases.html' %}
</section>
View
2 mkt/acct_lookup/templates/acct_lookup/user_summary.html
@@ -7,7 +7,7 @@
{% include 'acct_lookup/includes/user_search.html' %}
<section class="island c">
- {{ user_header(account, _('Account Lookup results for')) }}
+ {{ user_header(account, _('Account Lookup results for'), is_admin) }}
<section id="prose">
<dl>
View
4 mkt/acct_lookup/views.py
@@ -116,10 +116,12 @@ def sum_(qs):
def user_purchases(request, user_id):
"""Shows the purchase page for another user."""
user = get_object_or_404(UserProfile, pk=user_id)
+ is_admin = acl.action_allowed(request, 'Users', 'Edit')
products, contributions, listing = purchase_list(request, user, None)
return jingo.render(request, 'acct_lookup/user_purchases.html',
{'pager': products,
'account': user,
+ 'is_admin': is_admin,
'listing_filter': listing,
'contributions': contributions,
'single': bool(None),
@@ -132,6 +134,7 @@ def user_activity(request, user_id):
"""Shows the user activity page for another user."""
user = get_object_or_404(UserProfile, pk=user_id)
products, contributions, listing = purchase_list(request, user, None)
+ is_admin = acl.action_allowed(request, 'Users', 'Edit')
collections = Collection.objects.filter(author=user_id)
user_items = ActivityLog.objects.for_user(user).exclude(
@@ -142,6 +145,7 @@ def user_activity(request, user_id):
return jingo.render(request, 'acct_lookup/user_activity.html',
{'pager': products,
'account': user,
+ 'is_admin': is_admin,
'listing_filter': listing,
'collections': collections,
'contributions': contributions,

0 comments on commit b43b503

Please sign in to comment.
Something went wrong with that request. Please try again.