etna 0.1.27 → 0.1.32

Sign up to get free protection for your applications and to get access to all the features.
data/lib/etna/user.rb CHANGED
@@ -7,14 +7,14 @@ module Etna
7
7
  }
8
8
 
9
9
  def initialize params, token=nil
10
- @first, @last, @email, @encoded_permissions, encoded_flags = params.values_at(:first, :last, :email, :perm, :flags)
10
+ @name, @email, @encoded_permissions, encoded_flags = params.values_at(:name, :email, :perm, :flags)
11
11
 
12
12
  @flags = encoded_flags&.split(/;/) || []
13
13
  @token = token unless !token
14
14
  raise ArgumentError, "No email given!" unless @email
15
15
  end
16
16
 
17
- attr_reader :first, :last, :email, :token
17
+ attr_reader :name, :email, :token
18
18
 
19
19
  def permissions
20
20
  @permissions ||= @encoded_permissions.split(/\;/).map do |roles|
@@ -36,10 +36,6 @@ module Etna
36
36
  @flags.include?(flag)
37
37
  end
38
38
 
39
- def name
40
- "#{first} #{last}"
41
- end
42
-
43
39
  def projects
44
40
  permissions.keys
45
41
  end
@@ -50,7 +46,7 @@ module Etna
50
46
  viewer: /[Vv]/,
51
47
  restricted: /[AEV]/,
52
48
  }
53
- def has_roles(project, *roles)
49
+ def has_any_role?(project, *roles)
54
50
  perm = permissions[project.to_s]
55
51
 
56
52
  return false unless perm
@@ -59,15 +55,23 @@ module Etna
59
55
  end
60
56
 
61
57
  def is_superuser? project=nil
62
- has_roles(:administration, :admin)
58
+ has_any_role?(:administration, :admin)
59
+ end
60
+
61
+ def is_supereditor? project=nil
62
+ has_any_role?(:administration, :admin, :editor)
63
+ end
64
+
65
+ def is_superviewer? project=nil
66
+ has_any_role?(:administration, :admin, :editor, :viewer)
63
67
  end
64
68
 
65
69
  def can_edit? project
66
- is_superuser? || has_roles(project, :admin, :editor)
70
+ is_supereditor? || has_any_role?(project, :admin, :editor)
67
71
  end
68
72
 
69
73
  def can_view? project
70
- is_superuser? || has_roles(project, :admin, :editor, :viewer)
74
+ is_superviewer? || has_any_role?(project, :admin, :editor, :viewer)
71
75
  end
72
76
 
73
77
  # superusers - administrators of the Administration group - cannot
@@ -79,7 +83,7 @@ module Etna
79
83
  end
80
84
 
81
85
  def is_admin? project
82
- is_superuser? || has_roles(project, :admin)
86
+ is_superuser? || has_any_role?(project, :admin)
83
87
  end
84
88
 
85
89
  def active? project=nil
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.27
4
+ version: 0.1.32
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-01-14 00:00:00.000000000 Z
11
+ date: 2021-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: net-http-persistent
42
+ name: nokogiri
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -80,6 +80,34 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: concurrent-ruby
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: concurrent-ruby-ext
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
83
111
  description: See summary
84
112
  email: Saurabh.Asthana@ucsf.edu
85
113
  executables:
@@ -107,6 +135,7 @@ files:
107
135
  - lib/etna/clients/magma/client.rb
108
136
  - lib/etna/clients/magma/formatting.rb
109
137
  - lib/etna/clients/magma/formatting/models_csv.rb
138
+ - lib/etna/clients/magma/formatting/models_odm_xml.rb
110
139
  - lib/etna/clients/magma/models.rb
111
140
  - lib/etna/clients/magma/workflows.rb
112
141
  - lib/etna/clients/magma/workflows/add_project_models_workflow.rb
@@ -139,6 +168,7 @@ files:
139
168
  - lib/etna/controller.rb
140
169
  - lib/etna/cross_origin.rb
141
170
  - lib/etna/csvs.rb
171
+ - lib/etna/cwl.rb
142
172
  - lib/etna/describe_routes.rb
143
173
  - lib/etna/directed_graph.rb
144
174
  - lib/etna/environment_scoped.rb