from mako import runtime, filters, cache UNDEFINED = runtime.UNDEFINED __M_dict_builtin = dict __M_locals_builtin = locals _magic_number = 5 _modified_time = 1287725818.3254099 _template_filename=u'templates/dataset/security_common.mako' _template_uri=u'/dataset/security_common.mako' _template_cache=cache.Cache(__name__, _modified_time) _source_encoding=None _exports = ['render_permission_form', 'render_select'] def render_body(context,**pageargs): context.caller_stack._push_frame() try: __M_locals = __M_dict_builtin(pageargs=pageargs) __M_writer = context.writer() # SOURCE LINE 37 __M_writer(u'\n\n') # SOURCE LINE 123 __M_writer(u'\n') return '' finally: context.caller_stack._pop_frame() def render_render_permission_form(context,obj,obj_name,form_url,all_roles,do_not_render=[]): context.caller_stack._push_frame() try: trans = context.get('trans', UNDEFINED) def render_select(current_actions,action_key,action,all_roles): return render_render_select(context,current_actions,action_key,action,all_roles) isinstance = context.get('isinstance', UNDEFINED) __M_writer = context.writer() # SOURCE LINE 40 __M_writer(u'\n ') # SOURCE LINE 41 if isinstance( obj, trans.app.model.User ): current_actions = obj.default_permissions permitted_actions = trans.app.model.Dataset.permitted_actions.items() obj_str = 'user %s' % obj_name obj_type = 'dataset' elif isinstance( obj, trans.app.model.History ): current_actions = obj.default_permissions permitted_actions = trans.app.model.Dataset.permitted_actions.items() obj_str = 'history %s' % obj_name obj_type = 'dataset' elif isinstance( obj, trans.app.model.Dataset ): current_actions = obj.actions permitted_actions = trans.app.model.Dataset.permitted_actions.items() obj_str = obj_name obj_type = 'dataset' elif isinstance( obj, trans.app.model.LibraryDatasetDatasetAssociation ): current_actions = obj.actions + obj.dataset.actions permitted_actions = trans.app.model.Dataset.permitted_actions.items() + trans.app.model.Library.permitted_actions.items() obj_str = obj_name obj_type = 'dataset' elif isinstance( obj, trans.app.model.Library ): current_actions = obj.actions permitted_actions = trans.app.model.Library.permitted_actions.items() obj_str = 'library %s' % obj_name obj_type = 'library' elif isinstance( obj, trans.app.model.LibraryDataset ): current_actions = obj.actions permitted_actions = trans.app.model.Library.permitted_actions.items() obj_str = 'library dataset %s' % obj_name obj_type = 'library' elif isinstance( obj, trans.app.model.LibraryFolder ): current_actions = obj.actions permitted_actions = trans.app.model.Library.permitted_actions.items() obj_str = 'library folder %s' % obj_name obj_type = 'library' else: current_actions = [] permitted_actions = {}.items() obj_str = 'unknown object %s' %obj_name obj_type = '' # SOURCE LINE 82 __M_writer(u'\n \n
\n
Manage ') # SOURCE LINE 105 __M_writer(unicode(obj_type)) __M_writer(u' permissions on ') __M_writer(unicode(obj_str)) __M_writer(u'
\n
\n
\n
\n') # SOURCE LINE 109 for k, v in permitted_actions: # SOURCE LINE 110 if k not in do_not_render: # SOURCE LINE 111 __M_writer(u'
\n ') # SOURCE LINE 112 __M_writer(unicode(render_select( current_actions, k, v, all_roles ))) __M_writer(u'\n
\n') # SOURCE LINE 116 __M_writer(u'
\n \n
\n
\n
\n
\n

\n') return '' finally: context.caller_stack._pop_frame() def render_render_select(context,current_actions,action_key,action,all_roles): context.caller_stack._push_frame() try: filter = context.get('filter', UNDEFINED) x = context.get('x', UNDEFINED) trans = context.get('trans', UNDEFINED) __M_writer = context.writer() # SOURCE LINE 1 __M_writer(u'\n ') # SOURCE LINE 2 import sets in_roles = sets.Set() for a in current_actions: if a.action == action.action: in_roles.add( a.role ) out_roles = filter( lambda x: x not in in_roles, all_roles ) # SOURCE LINE 9 __M_writer(u'\n

\n ') # SOURCE LINE 11 __M_writer(unicode(action.action)) __M_writer(u': ') __M_writer(unicode(action.description)) __M_writer(u'\n') # SOURCE LINE 12 if action == trans.app.security_agent.permitted_actions.DATASET_ACCESS: # SOURCE LINE 13 __M_writer(u'
\n NOTE: Users must have every role associated with this dataset in order to access it\n') # SOURCE LINE 16 __M_writer(u'

\n
\n
\n Roles associated:
\n
\n
\n
\n
\n Roles not associated:
\n
\n \n
\n
\n') return '' finally: context.caller_stack._pop_frame()