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
|
.permissions
%h2
= model.name
%table
%tr
%td
Permissions for:
%b= model.web_uri
%tr
%td
User:
%b= session[:username]
has all permissions.
%table
%tr
%td
Model address:
%b= model.web_uri
%br
Model owner:
%b= session[:username]
%tr
%td
Group(s) you have joined:
%td
.info_update
Here you can change external(group) access for your model. First select an option then click on "update".
%tr
- policies.names.each do |n|
%tr
%td
%b= policies.policies[n].group
- js = "$('#policy_update_#{model.id}_#{n}').updatePolicy({id: '#{model.id}', mode: 'update', groupname: '#{policies.policies[n].group}', policyname: '#{n}'});\n "
:javascript
$(function() {
#{js}
});
%form{:name => "form_#{n}", :action => url_for("/policy/#{n}"), :method => "post", :enctype => "multipart/form-data", :id => "form_#{n}"}
%input{:type => 'hidden', :name => 'policyname', :value => n}
%input{:type => 'hidden', :name => 'id', :id => 'id', :value => model.id}
%input{:type => 'radio', :name => "select[#{policies.policies[n].group}]", :value => "not set", :checked => policies.policies[n].rule.read == nil} no group membership
%br
%input{:type => 'radio', :name => "select[#{policies.policies[n].group}]", :value => "read", :checked => policies.policies[n].rule.read == true} share with this group
%br
%input{:type => 'radio', :name => "select[#{policies.policies[n].group}]", :value => "readwrite", :checked => policies.policies[n].rule.readwrite == true} share with this group and allow members to delete the model
%br
%input{ :type => 'submit', :value => "update", :id=> "policy_update_#{model.id}_#{n}", :class => "policy_button"}
%br
%br
%tr
%td
Add to group:
%td
.info_add
Here you can share your model for external(group) access. Choose a group and option then click "add".
%tr
- groups.each do |g|
%tr
%td
%b= g
- js = "$('#policy_add_#{model.id}_#{g}').addPolicy({id: '#{model.id}', mode: 'add', groupname: '#{g}'});\n "
:javascript
$(function() {
#{js}
});
%form{:name => "form_#{g}", :action => url_for("/policy"), :method => "post", :enctype => "multipart/form-data", :id => "form_#{g}"}
%input{:type => 'hidden', :name => 'groupname', :value => g}
%input{:type => 'hidden', :name => 'id', :id => 'id', :value => model.id}
%input{:type => 'radio', :name => "selection[#{g}]", :value => "not set", :checked => "checked"} no membership with this group
%br
%input{:type => 'radio', :name => "selection[#{g}]", :value => "read"} share with this group
%br
%input{:type => 'radio', :name => "selection[#{g}]", :value => "readwrite"} share with this group and allow members to delete the model
%br
%input{ :type => 'submit', :value => "add", :id=> "policy_add_#{model.id}_#{g}", :class => "policy_button", :name => "form_#{g}"}
%br
%br
|