etna 0.1.41 → 0.1.44

Sign up to get free protection for your applications and to get access to all the features.
data/lib/etna/user.rb CHANGED
@@ -1,11 +1,7 @@
1
+ require_relative './permissions'
2
+
1
3
  module Etna
2
4
  class User
3
- ROLE_NAMES = {
4
- 'A' => :admin,
5
- 'E' => :editor,
6
- 'V' => :viewer
7
- }
8
-
9
5
  def initialize params, token=nil
10
6
  @name, @email, @encoded_permissions, encoded_flags, @task = params.values_at(:name, :email, :perm, :flags, :task)
11
7
 
@@ -21,19 +17,7 @@ module Etna
21
17
  end
22
18
 
23
19
  def permissions
24
- @permissions ||= @encoded_permissions.split(/\;/).map do |roles|
25
- role, projects = roles.split(/:/)
26
-
27
- projects.split(/\,/).reduce([]) do |perms,project_name|
28
- perms.push([
29
- project_name,
30
- {
31
- role: ROLE_NAMES[role.upcase],
32
- restricted: role == role.upcase
33
- }
34
- ])
35
- end
36
- end.inject([],:+).to_h
20
+ @permissions ||= Etna::Permissions.from_encoded_permissions(@encoded_permissions).to_hash
37
21
  end
38
22
 
39
23
  def has_flag?(flag)
@@ -44,12 +28,6 @@ module Etna
44
28
  permissions.keys
45
29
  end
46
30
 
47
- ROLE_MATCH = {
48
- admin: /[Aa]/,
49
- editor: /[Ee]/,
50
- viewer: /[Vv]/,
51
- restricted: /[AEV]/,
52
- }
53
31
  def has_any_role?(project, *roles)
54
32
  perm = permissions[project.to_s]
55
33
 
data/lib/etna.rb CHANGED
@@ -23,6 +23,7 @@ require_relative './etna/formatting'
23
23
  require_relative './etna/cwl'
24
24
  require_relative './etna/metrics'
25
25
  require_relative './etna/remote'
26
+ require_relative './etna/synchronize_db'
26
27
 
27
28
  class EtnaApp
28
29
  include Etna::Application
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: etna
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.41
4
+ version: 0.1.44
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saurabh Asthana
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-11 00:00:00.000000000 Z
11
+ date: 2022-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -138,6 +138,7 @@ files:
138
138
  - lib/etna.rb
139
139
  - lib/etna/application.rb
140
140
  - lib/etna/auth.rb
141
+ - lib/etna/censor.rb
141
142
  - lib/etna/client.rb
142
143
  - lib/etna/clients.rb
143
144
  - lib/etna/clients/base_client.rb
@@ -176,6 +177,8 @@ files:
176
177
  - lib/etna/clients/metis/workflows/metis_download_workflow.rb
177
178
  - lib/etna/clients/metis/workflows/metis_upload_workflow.rb
178
179
  - lib/etna/clients/metis/workflows/sync_metis_data_workflow.rb
180
+ - lib/etna/clients/metis/workflows/walk_metis_diff_workflow.rb
181
+ - lib/etna/clients/metis/workflows/walk_metis_workflow.rb
179
182
  - lib/etna/clients/polyphemus.rb
180
183
  - lib/etna/clients/polyphemus/client.rb
181
184
  - lib/etna/clients/polyphemus/models.rb
@@ -200,6 +203,7 @@ files:
200
203
  - lib/etna/metrics.rb
201
204
  - lib/etna/multipart_serializable_nested_hash.rb
202
205
  - lib/etna/parse_body.rb
206
+ - lib/etna/permissions.rb
203
207
  - lib/etna/remote.rb
204
208
  - lib/etna/route.rb
205
209
  - lib/etna/server.rb
@@ -208,6 +212,7 @@ files:
208
212
  - lib/etna/spec/auth.rb
209
213
  - lib/etna/spec/vcr.rb
210
214
  - lib/etna/symbolize_params.rb
215
+ - lib/etna/synchronize_db.rb
211
216
  - lib/etna/templates/attribute_actions_template.json
212
217
  - lib/etna/test_auth.rb
213
218
  - lib/etna/user.rb