Changeset 1409

Show
Ignore:
Timestamp:
02/14/08 14:53:16 (8 months ago)
Author:
JensDiemer
Message:

-filter the sub_menu for normal users
-limit access to a "must_admin" method for users how are is_staff or is_superuser
-set request.debug with _or_

Location:
trunk/pylucid/PyLucid
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/pylucid/PyLucid/plugins_internal/admin_menu/admin_menu.py

    r1168 r1409  
    4343        render the sub menu 
    4444        """ 
     45        is_admin = self.request.user.is_superuser or self.request.user.is_staff 
     46 
    4547        context = { 
    4648            "PAGE"            : self.context["PAGE"], 
    4749            "commandURLprefix": self.URLs.get_command_base(), 
    4850            "adminURLprefix"  : self.URLs["adminBase"], 
     51            "is_admin"        : is_admin, 
    4952        } 
    5053        self._render_template("sub_menu", context)#, debug=True) 
  • trunk/pylucid/PyLucid/plugins_internal/admin_menu/internal_pages/sub_menu.html

    r1384 r1409  
    1414</ul> 
    1515</fieldset> 
     16 
     17{% if is_admin %} 
    1618 
    1719<fieldset><legend>{% trans 'edit look' %}</legend> 
     
    6365</fieldset> 
    6466 
    65  
    66 {% comment %} 
    67 <fieldset><legend>{% trans 'backup' %}</legend> 
    68  
    69 * "{% trans 'DB dump' %}":{{ commandURLprefix }}/MySQLdump/menu 
    70  
    71 </fieldset> 
    72  
    73 <fieldset><legend>{% trans 'internals' %}</legend> 
    74  
    75 * <lucidTag:show_internals/> 
    76  
    77 </fieldset> 
    78 {% endcomment %} 
     67{% endif %} 
  • trunk/pylucid/PyLucid/system/plugin_manager.py

    r1392 r1409  
    142142            else: 
    143143                raise AccessDeny 
     144 
     145    if method_cfg["must_admin"]: 
     146        # The User must be an admin to use this method 
     147        if not (request.user.is_superuser or request.user.is_staff): 
     148            raise AccessDeny 
    144149 
    145150    URLs = context["URLs"] 
  • trunk/pylucid/PyLucid/system/utils.py

    r1304 r1409  
    2525    add the attribute "debug" to the request object. 
    2626    """ 
    27     if settings.DEBUG and \ 
     27    if settings.DEBUG or \ 
    2828                request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS: 
    2929        request.debug = True 
    3030    else: 
    3131        request.debug = False 
     32 
    3233 
    3334def get_uri_base():