From dd21a41cfd3018a1685805cf48a0c022b3a912c4 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Mon, 23 Apr 2012 20:10:26 +0000 Subject: Modified roles controller to use new handle_form function --- app/acf-util/roles-read-html.lsp | 59 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 app/acf-util/roles-read-html.lsp (limited to 'app/acf-util/roles-read-html.lsp') diff --git a/app/acf-util/roles-read-html.lsp b/app/acf-util/roles-read-html.lsp new file mode 100644 index 0000000..32000af --- /dev/null +++ b/app/acf-util/roles-read-html.lsp @@ -0,0 +1,59 @@ +<% local view= ... %> + +<% if view.value.userid then %> +

Roles/Permission list for <%= html.html_escape(view.value.userid.value) %>:

+<% elseif view.value.role then %> +

Permission list for <%= html.html_escape(view.value.role.value) %>:

+<% else %> +

Complete permission list:

+<% end %> + +<% if view.value.roles then %> +

<%= html.html_escape(view.value.userid.value) %> is valid in these roles

+
+ <% for a,b in pairs(view.value.roles.value) do + print("
",html.html_escape(b),"
 
") + end %> +
+<% end %> + +<% if view.value.permissions then %> + <% if view.value.userid then %> +

<%= html.html_escape(view.value.userid.value) %>'s full permissions are

+ <% elseif view.value.role then %> +

<%= html.html_escape(view.value.role.value) %>'s full permissions are

+ <% end %> +
+ + + <% local prefixes = {} + -- It's nice to have it in alphabetical order + for pref in pairs(view.value.permissions.value) do + prefixes[#prefixes + 1] = pref + end + table.sort(prefixes) + for w,pref in ipairs(prefixes) do + local controllers = {} + -- Again, alphabetical order + for cont in pairs(view.value.permissions.value[pref]) do + controllers[#controllers + 1] = cont + end + table.sort(controllers) + for x,cont in ipairs(controllers) do + print("") + end + end + %> +
ControllerAction(s)
",html.html_escape(pref..cont),"") + -- Again, alphabetical order + local actions = {} + for act in pairs(view.value.permissions.value[pref][cont]) do + actions[#actions + 1] = act + end + table.sort(actions) + for y,act in pairs(actions) do + print((html.html_escape(act))) + end + io.write("
+
+<% end %> -- cgit v1.2.3