booth 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c668536c8bd588ea518b1033cbb609ee2fe4eff849e66a507fcdea560968268
4
- data.tar.gz: ff67cfaf633cffb7975257ec93332ae5e7283b331a78b789303ce993604c8a71
3
+ metadata.gz: 75776c21f5e995703cc155d9689c504d9f5158c90b1e122c71c0cae6c7ec145f
4
+ data.tar.gz: 0f3ef4e56515e035e2d7f48244cacc4d66609972e8d00087ea8967124a995369
5
5
  SHA512:
6
- metadata.gz: 81b4366d2c6654c79402b09731420fd4782587b59c1ce8cf68da4f4a81dfabca495270ef1c8d3869814d150450d8b2539d4068f18182ef3daa85dc01a9b481fd
7
- data.tar.gz: 2d54c3e7c590331026916e29ad51c90605e8b0bda7a93efdb49ea4a9b51be06229a4a0ebfbded4b7e2c90e487a32e1225812ff72888f23db50406cbd2e31bfee
6
+ metadata.gz: cfc9d3c104de49717ee87ea1cfa49e3b85ee9a452817fb7eb9b3526c4529831280be737ab23397b58de7c43d422a4bb0cd337b065a342402266a928864b24065
7
+ data.tar.gz: ff800424fa6697a691f884c078892a742ac20fff360859facd027557d8c1917562425bba657161fb7131606675d6a88d8b44dde6ea8954c67850228472eea6f7
data/CHANGELOG.md CHANGED
@@ -1,15 +1,13 @@
1
1
  # main
2
2
 
3
- ```
4
- def change
5
- add_column :booth_authenticators, :aaguid, :uuid
6
- add_column :booth_authenticators, :attachment, :string
7
- add_column :booth_authenticators, :issuer, :string
8
- end
3
+ # 0.0.3
9
4
 
10
- ```
5
+ - Add Adminland.exist_authenticators()
6
+
7
+ # 0.0.2
8
+
9
+ - Remove passwords and OTPs
11
10
 
12
11
  # 0.0.1
13
12
 
14
- First publication for experimentation.
15
- Test coverage is pretty good and the code is rather safe - but use with caution.
13
+ - First publication for experimentation.
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Booth
4
+ module Adminland
5
+ module Authenticators
6
+ # Checks whether a credential has registered authenticators.
7
+ class Exist
8
+ include Calls
9
+ include ::Booth::Logging
10
+
11
+ option :credential_id
12
+
13
+ def call
14
+ return unknown_credential_result unless credential
15
+
16
+ count = credential.registered_authenticator_ids.size
17
+ case count
18
+ when 0 then no_authenticators_result
19
+ when 1 then one_authenticator_result
20
+ else multiple_authenticators_result
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ def unknown_credential_result
27
+ Tron.failure(:unknown_credential, at_least_one?: false, multiple?: false)
28
+ end
29
+
30
+ def no_authenticators_result
31
+ Tron.success(:no_authenticators, at_least_one?: false, multiple?: false)
32
+ end
33
+
34
+ def one_authenticator_result
35
+ Tron.success(:one_authenticator, at_least_one?: true, multiple?: false)
36
+ end
37
+
38
+ def multiple_authenticators_result
39
+ Tron.success(:multiple_authenticator, at_least_one?: true, multiple?: true)
40
+ end
41
+
42
+ def credential
43
+ return @credential if defined?(@credential)
44
+
45
+ @credential = ::Booth::Models::Credential.find_by(id: credential_id)
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -11,6 +11,14 @@ module Booth
11
11
  ::Booth::Adminland::Credentials::Create.call(...)
12
12
  end
13
13
 
14
+ # ---------------------
15
+ # Authenticator Helpers
16
+ # ---------------------
17
+
18
+ def self.exist_authenticators(...)
19
+ ::Booth::Adminland::Authenticators::Exist.call(...)
20
+ end
21
+
14
22
  # --------------
15
23
  # Onboarding Helpers
16
24
  # --------------
@@ -6,8 +6,6 @@ module Booth
6
6
  class Userland
7
7
  include Calls
8
8
 
9
- option :skip_registration, default: -> { false }
10
-
11
9
  def call
12
10
  <<-RUBY
13
11
  # Users creating their own accounts.
data/lib/booth/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Booth
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: booth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - halo
@@ -226,6 +226,7 @@ files:
226
226
  - data/combined_aaguid.json
227
227
  - lib/booth.rb
228
228
  - lib/booth/adminland.rb
229
+ - lib/booth/adminland/authenticators/exist.rb
229
230
  - lib/booth/adminland/credentials/create.rb
230
231
  - lib/booth/adminland/credentials/index.rb
231
232
  - lib/booth/adminland/onboardings/create.rb