booth 0.1.7 → 0.1.8
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/booth/adminland/credentials/block.rb +38 -0
- data/lib/booth/adminland/credentials/unblock.rb +37 -0
- data/lib/booth/adminland.rb +8 -0
- data/lib/booth/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d8e2da057058f232ca308dcb2476c51680f99633dab61b14ea0290ff0036d86b
|
|
4
|
+
data.tar.gz: b1a0a4e0d8514a34b455070adb3c5bfb2e349df3989392f896ac48c9afc1cce9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 318999c852e79ac40e1cc4cf1c00a613c0f5f8871fa62307491ddf92c102074378825c071ab388ed583d8b11bb9c1f1088ffcb91913a2c3d13e8d5676c689dd7
|
|
7
|
+
data.tar.gz: 542b4409646b3ea8d865a4f8908436707103a1ca57a86bf0bc836f926c0652c973e6126ce44a08ce7723e97874ffe3802c25b9b6622b0148cacac18a3191c9ac
|
data/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Booth
|
|
4
|
+
module Adminland
|
|
5
|
+
module Credentials
|
|
6
|
+
# Blocks a credential from authenticating.
|
|
7
|
+
class Block
|
|
8
|
+
include Calls
|
|
9
|
+
|
|
10
|
+
option :credential_id
|
|
11
|
+
|
|
12
|
+
def call
|
|
13
|
+
return Tron.failure(:credential_not_found) unless credential
|
|
14
|
+
|
|
15
|
+
if credential.blocked?
|
|
16
|
+
return Tron.success(:already_blocked,
|
|
17
|
+
id: credential.id,
|
|
18
|
+
blocked_at: credential.blocked_at)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
blocked_at = Time.current
|
|
22
|
+
credential.update!(blocked_at:)
|
|
23
|
+
|
|
24
|
+
Tron.success(:credential_blocked, id: credential.id, blocked_at:)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def credential
|
|
30
|
+
return @credential if defined?(@credential)
|
|
31
|
+
|
|
32
|
+
uuid = ::Booth::Syntaxes::Uuid.call(credential_id, raise_if_invalid: false).uuid
|
|
33
|
+
@credential = ::Booth::Models::Credential.find_by(id: uuid) if uuid
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Booth
|
|
4
|
+
module Adminland
|
|
5
|
+
module Credentials
|
|
6
|
+
# Allows a credential to authenticate again.
|
|
7
|
+
class Unblock
|
|
8
|
+
include Calls
|
|
9
|
+
|
|
10
|
+
option :credential_id
|
|
11
|
+
|
|
12
|
+
def call
|
|
13
|
+
return Tron.failure(:credential_not_found) unless credential
|
|
14
|
+
|
|
15
|
+
unless credential.blocked?
|
|
16
|
+
return Tron.success(:already_unblocked,
|
|
17
|
+
id: credential.id,
|
|
18
|
+
blocked_at: credential.blocked_at)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
credential.update!(blocked_at: nil)
|
|
22
|
+
|
|
23
|
+
Tron.success(:credential_unblocked, id: credential.id, blocked_at: nil)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
def credential
|
|
29
|
+
return @credential if defined?(@credential)
|
|
30
|
+
|
|
31
|
+
uuid = ::Booth::Syntaxes::Uuid.call(credential_id, raise_if_invalid: false).uuid
|
|
32
|
+
@credential = ::Booth::Models::Credential.find_by(id: uuid) if uuid
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
data/lib/booth/adminland.rb
CHANGED
|
@@ -7,6 +7,14 @@ module Booth
|
|
|
7
7
|
# Credential Helpers
|
|
8
8
|
# ------------------
|
|
9
9
|
|
|
10
|
+
def self.block_credential(...)
|
|
11
|
+
::Booth::Adminland::Credentials::Block.call(...)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.unblock_credential(...)
|
|
15
|
+
::Booth::Adminland::Credentials::Unblock.call(...)
|
|
16
|
+
end
|
|
17
|
+
|
|
10
18
|
def self.create_credential(...)
|
|
11
19
|
::Booth::Adminland::Credentials::Create.call(...)
|
|
12
20
|
end
|
data/lib/booth/version.rb
CHANGED
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.1.
|
|
4
|
+
version: 0.1.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- halo
|
|
@@ -228,8 +228,10 @@ files:
|
|
|
228
228
|
- lib/booth.rb
|
|
229
229
|
- lib/booth/adminland.rb
|
|
230
230
|
- lib/booth/adminland/authenticators/exist.rb
|
|
231
|
+
- lib/booth/adminland/credentials/block.rb
|
|
231
232
|
- lib/booth/adminland/credentials/create.rb
|
|
232
233
|
- lib/booth/adminland/credentials/index.rb
|
|
234
|
+
- lib/booth/adminland/credentials/unblock.rb
|
|
233
235
|
- lib/booth/adminland/incognitos/consume_token.rb
|
|
234
236
|
- lib/booth/adminland/incognitos/generate_secret_key.rb
|
|
235
237
|
- lib/booth/adminland/incognitos/stop_incognito.rb
|
|
@@ -417,7 +419,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
417
419
|
- !ruby/object:Gem::Version
|
|
418
420
|
version: '0'
|
|
419
421
|
requirements: []
|
|
420
|
-
rubygems_version:
|
|
422
|
+
rubygems_version: 4.0.20
|
|
421
423
|
specification_version: 4
|
|
422
424
|
summary: Opinionated authentication framework for Rails
|
|
423
425
|
test_files: []
|