[ckan-changes] commit/ckanextiati: pudo: fix authz check

Bitbucket commits-noreply at bitbucket.org
Tue May 24 19:22:48 UTC 2011


1 new changeset in ckanextiati:

http://bitbucket.org/okfn/ckanextiati/changeset/bd86d7d6ba40/
changeset:   r63:bd86d7d6ba40
user:        pudo
date:        2011-05-24 21:22:41
summary:     fix authz check
affected #:  1 file (106 bytes)

--- a/ckanext/iati/forms/group.py	Tue May 24 18:46:07 2011 +0200
+++ b/ckanext/iati/forms/group.py	Tue May 24 21:22:41 2011 +0200
@@ -22,14 +22,17 @@
                        _("Community")]
     
     builder = FormBuilder(model.Group)
-    builder.set_field_text('name', 'Unique Name (required)', literal("<br/><strong>Unique identifier</strong> for group.<br/>2+ chars, lowercase, using only 'a-z0-9' and '-_'"))
+    builder.set_field_text('name', 'Unique Name (required)', 
+            literal("<br/><strong>Unique identifier</strong> for group.<br/>2+ chars, lowercase, using only 'a-z0-9' and '-_'"))
     builder.set_field_option('name', 'validate', common.group_name_validator)
     builder.set_field_option('state', 'dropdown', {'options':model.State.all})
     builder.add_field(SelectExtraField('type', options=PUBLISHER_TYPES, allow_empty=False))
     builder.set_field_text('type', 'Type')
     displayed_fields = ['name', 'title', 'type']
     
-    if is_admin:
+    from ckan.authz import Authorizer
+    from ckan.lib.base import c
+    if Authorizer.is_sysadmin(c.user):
         displayed_fields.append('state')
     #builder.add_field(ExtrasField('extras', hidden_label=True))
     
@@ -42,4 +45,4 @@
 
 def get_group_fieldset(is_admin=False, combined=False):
     return build_group_form(is_admin=is_admin, with_packages=combined).get_fieldset()
-   
\ No newline at end of file
+

Repository URL: https://bitbucket.org/okfn/ckanextiati/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list