authify-api 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/lib/authify/api/controllers/user.rb +32 -0
- data/lib/authify/api/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14d6a59892c799848cfafc2560f6c8a563d47931
|
4
|
+
data.tar.gz: ac147175656a4ba68993aa277a08a54636dd5fd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d70a5903b23f8cd25965bba23345a61d1a076eae15187ff79882131d0b7c1a408ffb08708d90e6ca84a60762327b6354ed59647b4032d7592f63ca18a48176fc
|
7
|
+
data.tar.gz: 9eb2b416d3ce781d6f1abd6891790ab359bfda9aff40adee30ebc72b4f775a551116cc121dcd21f4b99714b80ef5a91862042bd4d286f5656015fcceb495c56b
|
data/.rubocop.yml
CHANGED
@@ -3,6 +3,18 @@ module Authify
|
|
3
3
|
module Controllers
|
4
4
|
User = proc do
|
5
5
|
helpers do
|
6
|
+
def before_index
|
7
|
+
params[:fields] = only_indexable_fields
|
8
|
+
end
|
9
|
+
|
10
|
+
def before_show_many
|
11
|
+
params[:fields] = only_indexable_fields
|
12
|
+
end
|
13
|
+
|
14
|
+
def before_show
|
15
|
+
params[:fields] = only_indexable_fields
|
16
|
+
end
|
17
|
+
|
6
18
|
def find(id)
|
7
19
|
Models::User.find(id.to_i)
|
8
20
|
end
|
@@ -19,6 +31,26 @@ module Authify
|
|
19
31
|
end
|
20
32
|
end
|
21
33
|
|
34
|
+
def indexable_fields
|
35
|
+
%i[full-name admin apikeys groups organizations identities].tap do |a|
|
36
|
+
if role?(:admin) || role?(:myself)
|
37
|
+
a << :verified
|
38
|
+
a << :email
|
39
|
+
a << :'created-at'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def only_indexable_fields
|
45
|
+
{
|
46
|
+
users: if params[:fields] && params[:fields].key?(:users)
|
47
|
+
params[:fields][:users].select { |k, _| indexable_fields.include?(k) }
|
48
|
+
else
|
49
|
+
indexable_fields
|
50
|
+
end
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
22
54
|
def filtered_attributes(attributes)
|
23
55
|
attributes.select do |k, _v|
|
24
56
|
modifiable_fields.include?(k)
|
data/lib/authify/api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authify-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Gnagy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: authify-core
|