summaryrefslogtreecommitdiff
path: root/app/views/pages/technology/infosec/table.haml
blob: 0f6a92f1a12e7716ef79e53a09435b80ee567b43 (plain)
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
:ruby

  if table_type == :small
    ##
    ## SMALL TABLE
    ##
    columns = [:p2p, :ssilo, :sfed]
    column_data = {
      :ssilo  => [:silo, :encrypted],
      :sfed   => [:federation, :encrypted],
      :p2p    => [:peer_to_peer, :encrypted]
    }
    rows = [:availability, :usability, :compatibility, :authenticity, :control, :anonymity]
    row_groups = []
    footer = false
    cells = {
      :ssilo => {
        :control         => [:lower],
        :compatibility   => [:lower],
        :usability       => [:higher],
        :authenticity    => [:lower],
        :availability    => [:higher],
        :anonymity       => [:lower]
      },
      :sfed => {
        :control         => [:higher],
        :compatibility   => [:higher],
        :usability       => [:lower],
        :authenticity    => [:higher],
        :availability    => [:lower],
        :anonymity       => [:lower]
      },
      :p2p => {
        :control         => [:higher],
        :compatibility   => [:lower],
        :usability       => [:lower],
        :authenticity    => [:higher],
        :availability    => [:lower],
        :anonymity       => [:higher]
      }
    }
  elsif table_type == :big
    ##
    ## BIG TABLE
    ##
    columns = [:silo, :fed, :ssilo, :sfed, :p2p]
    column_data = {
      :silo   => [:silo, :cleartext, :silo_example],
      :fed    => [:federation, :cleartext, :fed_example],
      :ssilo  => [:silo, :encrypted, :ssilo_example],
      :sfed   => [:federation, :encrypted, :sfed_example],
      :p2p    => [:peer_to_peer, :encrypted, :p2p_example],
      :spacer  => [:spacer, :spacer, :spacer]
    }
    rows = [
      :control, :compatibility, :usability,
      :anonymity, :unmappability, :authenticity,
      :availability, :confidentiality, :integrity
    ]
    row_groups = [:message_security, :identity_security, :user_freedom]
    row_groups_data = {
      :user_freedom      => [:control, :compatibility, :usability],
      :identity_security => [:authenticity, :anonymity, :unmappability],
      :message_security  => [:confidentiality, :integrity, :availability]
    }
    footer = true
    cells = {
      :silo => {
        :control         => [:none],
        :compatibility   => [:none],
        :usability       => [:high],
        :anonymity       => [:none],
        :unmappability   => [:none],
        :authenticity    => [:none],
        :availability    => [:high],
        :confidentiality => [:none],
        :integrity       => [:none]
      },
      :fed => {
        :control         => [:medium],
        :compatibility   => [:high],
        :usability       => [:medium],
        :anonymity       => [:none],
        :unmappability   => [:none],
        :authenticity    => [:none],
        :availability    => [:medium],
        :confidentiality => [:none],
        :integrity       => [:none]
      },
      :ssilo => {
        :control         => [:none],
        :compatibility   => [:none],
        :usability       => [:high],
        :anonymity       => [:low],
        :unmappability   => [:none],
        :authenticity    => [:none],
        :availability    => [:high],
        :confidentiality => [:high],
        :integrity       => [:high]
      },
      :sfed => {
        :control         => [:medium],
        :compatibility   => [:medium],
        :usability       => [:low],
        :anonymity       => [:low],
        :unmappability   => [:none],
        :authenticity    => [:low],
        :availability    => [:medium],
        :confidentiality => [:high],
        :integrity       => [:high]
      },
      :p2p => {
        :control         => [:high],
        :compatibility   => [:none],
        :usability       => [:low],
        :anonymity       => [:medium],
        :unmappability   => [:medium],
        :authenticity    => [:low],
        :availability    => [:low],
        :confidentiality => [:high],
        :integrity       => [:high]
      },
      :spacer => {
        :control         => [:spacer],
        :compatibility   => [:spacer],
        :usability       => [:spacer],
        :anonymity       => [:spacer],
        :unmappability   => [:spacer],
        :authenticity    => [:spacer],
        :availability    => [:spacer],
        :confidentiality => [:spacer],
        :integrity       => [:spacer]
      }
    }
  elsif table_type == :leap
    ##
    ## LEAP TABLE
    ##
    columns = [:fed, :sfed, :leap]
    column_data = {
      :ssilo  => [:silo, :encrypted],
      :sfed   => [:federation, :encrypted],
      :p2p    => [:peer_to_peer, :encrypted],
      :fed    => [:federation, :cleartext],
      :leap   => [:leap, :encrypted]
    }
    rows = [
      :control, :compatibility, :usability,
      :anonymity, :unmappability, :authenticity,
      :availability, :confidentiality, :integrity
    ]
    row_groups = [:message_security, :identity_security, :user_freedom]
    row_groups_data = {
      :user_freedom      => [:control, :compatibility, :usability],
      :identity_security => [:authenticity, :anonymity, :unmappability],
      :message_security  => [:confidentiality, :integrity, :availability]
    }
    footer = false
    cells = {
      :fed => {
        :control         => [:medium],
        :compatibility   => [:high],
        :usability       => [:medium],
        :anonymity       => [:none],
        :unmappability   => [:none],
        :authenticity    => [:none],
        :availability    => [:medium],
        :confidentiality => [:none],
        :integrity       => [:none]
      },
      :sfed => {
        :control         => [:medium],
        :compatibility   => [:medium],
        :usability       => [:low],
        :anonymity       => [:low],
        :unmappability   => [:none],
        :authenticity    => [:low],
        :availability    => [:medium],
        :confidentiality => [:high],
        :integrity       => [:high]
      },
      :leap => {
        :control         => [:medium],
        :compatibility   => [:worse],
        :usability       => [:better],
        :anonymity       => [:low],
        :unmappability   => [:better],
        :authenticity    => [:better],
        :availability    => [:medium],
        :confidentiality => [:high],
        :integrity       => [:high]
      }
    }
  end

%table.infosec
  %tr
    %th.first
    - if row_groups.any?
      %th.second
    - columns.each do |column|
      - if column == :spacer
        %th.spacer
      - else
        %th.cell
          = I18n.t column_data[column][0], :scope => 'infosec'
          %br<>
          %span.normal
            = I18n.t column_data[column][1], :scope => 'infosec'
  - if row_groups.any?
    - row_groups.each do |row_group|
      %tbody
        - rows = row_groups_data[row_group]
        - rows.each do |row|
          %tr
            - if rows.first == row
              %td{:rowspan=>3}= I18n.t(row_group, :scope => 'infosec').sub(' ', '<br/>').html_safe
            %td= I18n.t row, :scope => 'infosec'
            - columns.each do |column|
              %td.cell{:class => cells[column][row]}= I18n.t cells[column][row], :scope => 'infosec'
  - else
    - rows.each do |row|
      %tbody
        %tr
          %td= I18n.t row, :scope => 'infosec'
          - columns.each do |column|
            %td.cell{:class => cells[column][row]}= I18n.t cells[column][row], :scope => 'infosec'
  - if footer
    %tr.footer
      %td{:colspan=>2}= I18n.t :for_example, :scope => 'infosec'
      - columns.each do |column|
        %td= I18n.t column_data[column][2], :scope => 'infosec'