[2] | 1 | <%inherit file="/base.mako"/> |
---|
| 2 | <%namespace file="/message.mako" import="render_msg" /> |
---|
| 3 | |
---|
| 4 | |
---|
| 5 | %if message: |
---|
| 6 | ${render_msg( message, status )} |
---|
| 7 | %endif |
---|
| 8 | |
---|
| 9 | <script type="text/javascript"> |
---|
| 10 | $( document ).ready( function () { |
---|
| 11 | $( '.role_add_button' ).click( function() { |
---|
| 12 | var action = this.id.substring( 0, this.id.lastIndexOf( '_add_button' ) ) |
---|
| 13 | var in_select = '#' + action + '_in_select'; |
---|
| 14 | var out_select = '#' + action + '_out_select'; |
---|
| 15 | return !$( out_select + ' option:selected' ).remove().appendTo( in_select ); |
---|
| 16 | }); |
---|
| 17 | $( '.role_remove_button' ).click( function() { |
---|
| 18 | var action = this.id.substring( 0, this.id.lastIndexOf( '_remove_button' ) ) |
---|
| 19 | var in_select = '#' + action + '_in_select'; |
---|
| 20 | var out_select = '#' + action + '_out_select'; |
---|
| 21 | return !$( in_select + ' option:selected' ).remove().appendTo( out_select ); |
---|
| 22 | }); |
---|
| 23 | $( 'form#request_type_permissions' ).submit( function() { |
---|
| 24 | $( '.in_select option' ).each(function( i ) { |
---|
| 25 | $( this ).attr( "selected", "selected" ); |
---|
| 26 | }); |
---|
| 27 | }); |
---|
| 28 | }); |
---|
| 29 | </script> |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | <div class="toolForm"> |
---|
| 33 | <div class="toolFormTitle">Manage permissions on "${request_type.name}"</div> |
---|
| 34 | <div class="toolFormBody"> |
---|
| 35 | <form name="request_type_permissions" id="request_type_permissions" action="${h.url_for( controller='requests_admin', action='request_type_permissions', id=trans.security.encode_id( request_type.id ) )}" method="post"> |
---|
| 36 | <div class="form-row"> |
---|
| 37 | <% |
---|
| 38 | obj_name = request_type.name |
---|
| 39 | current_actions = request_type.actions |
---|
| 40 | permitted_actions = trans.app.model.RequestType.permitted_actions.items() |
---|
| 41 | action = trans.app.model.RequestType.permitted_actions.REQUEST_TYPE_ACCESS |
---|
| 42 | obj_str = 'request_type %s' % obj_name |
---|
| 43 | obj_type = 'request_type' |
---|
| 44 | all_roles = roles |
---|
| 45 | action_key = 'REQUEST_TYPE_ACCESS' |
---|
| 46 | |
---|
| 47 | import sets |
---|
| 48 | in_roles = sets.Set() |
---|
| 49 | for a in current_actions: |
---|
| 50 | if a.action == action.action: |
---|
| 51 | in_roles.add( a.role ) |
---|
| 52 | out_roles = filter( lambda x: x not in in_roles, all_roles ) |
---|
| 53 | %> |
---|
| 54 | <p> |
---|
| 55 | <b>access sequencer configuration:</b> Restrict access to this sequencer configuration to only role members |
---|
| 56 | </p> |
---|
| 57 | <div style="width: 100%; white-space: nowrap;"> |
---|
| 58 | <div style="float: left; width: 50%;"> |
---|
| 59 | Roles associated:<br/> |
---|
| 60 | <select name="${action_key}_in" id="${action_key}_in_select" class="in_select" style="max-width: 98%; width: 98%; height: 150px; font-size: 100%;" multiple> |
---|
| 61 | %for role in in_roles: |
---|
| 62 | <option value="${role.id}">${role.name}</option> |
---|
| 63 | %endfor |
---|
| 64 | </select> <br/> |
---|
| 65 | <div style="width: 98%; text-align: right"><input type="submit" id="${action_key}_remove_button" class="role_remove_button" value=">>"/></div> |
---|
| 66 | </div> |
---|
| 67 | <div style="width: 50%;"> |
---|
| 68 | Roles not associated:<br/> |
---|
| 69 | <select name="${action_key}_out" id="${action_key}_out_select" style="max-width: 98%; width: 98%; height: 150px; font-size: 100%;" multiple> |
---|
| 70 | %for role in out_roles: |
---|
| 71 | <option value="${role.id}">${role.name}</option> |
---|
| 72 | %endfor |
---|
| 73 | </select> <br/> |
---|
| 74 | <input type="submit" id="${action_key}_add_button" class="role_add_button" value="<<"/> |
---|
| 75 | </div> |
---|
| 76 | </div> |
---|
| 77 | ## </%def> |
---|
| 78 | </div> |
---|
| 79 | <div class="form-row"> |
---|
| 80 | <input type="submit" name="update_roles_button" value="Save"/> |
---|
| 81 | </div> |
---|
| 82 | </form> |
---|
| 83 | </div> |
---|
| 84 | </div> |
---|