Edited the access check for show in site settings.
authorLennard de Rijk <ljvderijk@gmail.com>
Sat, 31 Jan 2009 13:59:49 +0000
changeset 1109 a83d8c5e6650
parent 1108 64acc3c02ad1
child 1110 027efd049770
Edited the access check for show in site settings. Not everyone should see our keys :). And also moved the template to site folder and changed presence back to the way it should be. Patch by: Lennard de Rijk Reviewed by: to-be-reviewed
app/soc/templates/soc/presence/public.html
app/soc/templates/soc/site/public.html
app/soc/views/models/site.py
--- a/app/soc/templates/soc/presence/public.html	Sat Jan 31 13:49:50 2009 +0000
+++ b/app/soc/templates/soc/presence/public.html	Sat Jan 31 13:59:49 2009 +0000
@@ -22,11 +22,13 @@
 <p>
  <table>
   {% readonly_field_as_table_row entity.fields.link_id.label entity.link_id %}
+  {% if entity.home %}
   {% readonly_field_as_table_row entity.fields.home.label entity.home.key.name %}
+  {% endif %}
   {% readonly_field_as_table_row entity.fields.feed_url.label entity.feed_url %}
-  {% readonly_field_as_table_row entity.fields.tos.label entity.tos %}
-  {% readonly_field_as_table_row entity.fields.ga_tracking_num.label entity.ga_tracking_num %}
-  {% readonly_field_as_table_row entity.fields.gmaps_api_key.label entity.gmaps_api_key %}
+  {% if entity.tos %}
+    {% readonly_field_as_table_row entity.fields.tos.label entity.tos.key.name %}
+  {% endif %}
   <!-- TODO(pawel.solyga) make this generic -->
  </table>
 </p>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/site/public.html	Sat Jan 31 13:59:49 2009 +0000
@@ -0,0 +1,37 @@
+{% extends "soc/base.html" %}
+{% comment %}
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+{% load forms_helpers %}
+
+{% block header_title %}
+{{ page_name }} for {{ entity.link_id }}
+{% endblock %}
+
+{% block body %}
+<p>
+ <table>
+  {% readonly_field_as_table_row entity.fields.link_id.label entity.link_id %}
+  {% if entity.home %}
+  {% readonly_field_as_table_row entity.fields.home.label entity.home.key.name %}
+  {% endif %}
+  {% readonly_field_as_table_row entity.fields.feed_url.label entity.feed_url %}
+  {% if entity.tos %}
+    {% readonly_field_as_table_row entity.fields.tos.label entity.tos.key.name %}
+  {% endif %}
+  {% readonly_field_as_table_row entity.fields.ga_tracking_num.label entity.ga_tracking_num %}
+  {% readonly_field_as_table_row entity.fields.gmaps_api_key.label entity.gmaps_api_key %}
+  <!-- TODO(pawel.solyga) make this generic -->
+ </table>
+</p>
+{% endblock %}
--- a/app/soc/views/models/site.py	Sat Jan 31 13:49:50 2009 +0000
+++ b/app/soc/views/models/site.py	Sat Jan 31 13:59:49 2009 +0000
@@ -51,7 +51,7 @@
     rights = access.Checker(params)
     rights['unspecified'] = ['checkIsDeveloper']
     rights['any_access'] = ['allow']
-    rights['show'] = ['allow']
+    rights['show'] = ['checkIsDeveloper']
 
     new_params = {}
     new_params['logic'] = soc.logic.models.site.logic
@@ -64,11 +64,9 @@
     new_params['sidebar_defaults'] = [('/%s/edit', 'Edit %(name)s', 'edit')]
     new_params['sidebar_heading'] = new_params['name_short']
 
-    new_params['public_template'] = 'soc/presence/public.html'
     new_params['edit_template'] = 'soc/site/edit.html'
     new_params['home_template'] = 'soc/site/home.html'
 
-    new_params['extra_dynaexclude'] = ['is_enabled']
     new_params['create_extra_dynafields'] = {
         'link_id': forms.CharField(widget=forms.HiddenInput, required=True),
         }