ó
ËîSc           @   s  d  d l  Z  d  d l Z d  d l m Z d  d l m Z d  d l m Z d  d l m Z d  d l	 m
 Z
 d Z d Z d	 Z d
 Z d d g Z d Z e d d d e ƒZ e d d e ƒZ d d „ Z d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d e  j f d „  ƒ  YZ d S(   iÿÿÿÿN(   t   in_any_group(   t   HTTPUnauthorized(   t	   structure(   t   custom(   t   gettings-   This page is restricted to GMs and observers.s   Only GMs can make edits.s3   You don't have access to this page; try logging in?s*   You must be logged in to access this page.u   GMu   NPCt   msgc         C   s(   |  d  k r t j j }  n  t j |  ƒ S(   N(   t   Nonet   pylonst   requestt   environt   EDITOR_PREDt   is_met(   R	   (    (    sZ   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/gameki/restricted.pyt	   is_editor   s    c         C   s   t  j |  ƒ S(   N(   R   t   is_omniscient(   R	   (    (    sZ   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/gameki/restricted.pyR      s    c           C   s"   t  j j r t  j j d Sd  Sd  S(   Nt   element(   t   tgR   t   identityR   (    (    (    sZ   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/gameki/restricted.pyt   logged_in_user!   s    c          C   s%   t  ƒ  }  |  r |  d j ƒ  Sd  Sd  S(   Nu   username(   R   t   renderR   (   t   user(    (    sZ   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/gameki/restricted.pyt   logged_in_username&   s    	c           C   s   t  j t ƒ t ƒ  S(   N(   R   t   flasht   OMNISCIENT_ONLYR   (    (    (    sZ   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/gameki/restricted.pyt   omniscient_only-   s    c           C   s   t  j t ƒ t ƒ  S(   N(   R   R   t   NOT_YOUR   (    (    (    sZ   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/gameki/restricted.pyt   not_you0   s    c           C   s   t  j t ƒ t ƒ  S(   N(   R   R   t   LOG_INR   (    (    (    sZ   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/gameki/restricted.pyt   log_in3   s    t
   Restrictedc           B   s#   e  Z e Z e j ƒ  d  „  ƒ Z RS(   c         C   s   t  j | d t j | ƒ ƒ S(   Nt   html(   R   t   getR   t   get_element(   t   selft   ename(    (    sZ   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/gameki/restricted.pyt   _default:   s    (   t   __name__t
   __module__t   PREDt
   allow_onlyR   t   exposeR"   (    (    (    sZ   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/gameki/restricted.pyR   7   s   (   R   R   t   repoze.what.predicatesR    t	   webob.excR   t   bazbaseR   R   t   bazkiR   R   t   GMS_ONLYR   R   t   GROUPSt   EDITOR_ANCESTORR%   R
   R   R   R   R   R   R   R   R   t   TGControllerR   (    (    (    sZ   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/gameki/restricted.pyt   <module>   s,   						