File: permissions.ejs

package info (click to toggle)
rabbitmq-server 2.8.4-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 8,928 kB
  • sloc: erlang: 52,968; python: 2,846; xml: 1,987; sh: 816; makefile: 683; perl: 86; ruby: 63
file content (91 lines) | stat: -rw-r--r-- 2,961 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<div class="section">
  <h2>Permissions</h2>
  <div class="hider">
    <h3>Current permissions</h3>
    <% if (permissions.length > 0) { %>
    <table class="list">
      <thead>
        <tr>
<% if (mode == 'vhost') { %>
          <th>User</th>
<% } else { %>
          <th>Virtual host</th>
<% } %>
          <th>Configure regexp</th>
          <th>Write regexp</th>
          <th>Read regexp</th>
          <th></th>
        </tr>
      </thead>
      <tbody>
<%
for (var i = 0; i < permissions.length; i++) {
    var permission = permissions[i];
%>
           <tr<%= alt_rows(i)%>>
<% if (mode == 'vhost') { %>
             <td><%= link_user(permission.user) %></td>
<% } else { %>
             <td><%= link_vhost(permission.vhost) %></td>
<% } %>
             <td><%= fmt_string(permission.configure) %></td>
             <td><%= fmt_string(permission.write) %></td>
             <td><%= fmt_string(permission.read) %></td>
             <td class="c">
               <form action="#/permissions" method="delete" class="confirm">
                 <input type="hidden" name="username" value="<%= fmt_string(permission.user) %>"/>
                 <input type="hidden" name="vhost" value="<%= fmt_string(permission.vhost) %>"/>
                 <input type="submit" value="Clear"/>
               </form>
             </td>
           </tr>
           <% } %>
      </tbody>
    </table>
    <% } else { %>
      <p>... no permissions ...</p>
    <% } %>

    <h3>Set permission</h3>
    <form action="#/permissions" method="put">
      <table class="form">
        <tr>
<% if (mode == 'vhost') { %>
          <th>User</th>
          <td>
            <input type="hidden" name="vhost" value="<%= fmt_string(parent.name) %>"/>
            <select name="username">
              <% for (var i = 0; i < users.length; i++) { %>
              <option value="<%= fmt_string(users[i].name) %>"><%= fmt_string(users[i].name) %></option>
              <% } %>
            </select>
          </td>
<% } else { %>
          <th><label>Virtual Host:</label></th>
          <td>
            <input type="hidden" name="username" value="<%= fmt_string(parent.name) %>"/>
            <select name="vhost">
              <% for (var i = 0; i < vhosts.length; i++) { %>
              <option value="<%= fmt_string(vhosts[i].name) %>"><%= fmt_string(vhosts[i].name) %></option>
              <% } %>
            </select>
          </td>
<% } %>
        </tr>
        <tr>
          <th><label>Configure regexp:</label></th>
          <td><input type="text" name="configure" value=".*"/></td>
        </tr>
        <tr>
          <th><label>Write regexp:</label></th>
          <td><input type="text" name="write" value=".*"/></td>
        </tr>
        <tr>
          <th><label>Read regexp:</label></th>
          <td><input type="text" name="read" value=".*"/></td>
        </tr>
      </table>
      <input type="submit" value="Set permission"/>
    </form>
  </div>
</div>