virtuatable-core 1.6.0.dev3 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9dfb4fa2fa19ff981a12cd82df061d7c39936e4a5d45aff4115ca6d30adde608
4
- data.tar.gz: 9c98b7459fe2be97b905c443e493f3af2b82d1b295f791fe61458c3d53f54a50
3
+ metadata.gz: b330926b15e557e0b16d5858262fafd042d46f1cd4938fad4c012795bc1f6fc9
4
+ data.tar.gz: f07af3efd591fd82840e623ab0f414459d25a109cc04a24341409ee16d06cf94
5
5
  SHA512:
6
- metadata.gz: dea8649e84d34cedd4392482426fd65399175c089ce711d36694a3769faff8d6f5dff20a8b1b5563c7189e022e42d87c523ad6593412b5fdadcead9e168e3603
7
- data.tar.gz: eecbb2dd1b8b2e01b6337543a976934294f7dfab2ebe048bb0767b91e856585e4d0200fe38baf8a81a80b02043334a8713723a06a5c0db0559786f81702f60b2
6
+ metadata.gz: cf83681ed7f261af971a5f60671a14ab1e16173e7b754ee6ffe9fc8ae3eda64d7a28ea2cd09529fded0e71f7bfc2cd415b961cc65b222a2ed2d7b90b1b6f386d
7
+ data.tar.gz: 8f0e5d901df834b6f48a34e9371ba2d473afbf1790eca64727de70e2b9e3750aaf3a15ae2052c2babecc176cda463b972aa0e9b28e59a908f5dee7aab0ff5a01
@@ -8,6 +8,26 @@ module Core
8
8
  class Authorizations < Core::Services::Base
9
9
  include Singleton
10
10
 
11
+ # Creates an authorization to access to the data of the user for the application. The user is
12
+ # identified by the UUID of its current connection session.
13
+ # [WARNING] this method should NOT be used outside of the authentication backend.
14
+ #
15
+ # @param session_id [String] the unique identifier of the current session of the user.
16
+ # @param client_id [String] the unique public identifier of the application.
17
+ # @return [Code::Decorators::Authorization] the created authorization
18
+ #
19
+ # @raise [Core::Helpers::Errors::BadRequest] if any of the parameters is not given
20
+ # @raise [Core::Helpers::Errors::NotFound] if the session or the application is not found
21
+ def create_from_session(session_id: nil, client_id: nil, **ignored)
22
+ session = Core.svc.sessions.get_by_id(session_id: session_id)
23
+ application = Core.svc.applications.get_by_id(client_id: client_id)
24
+ authorization = Core::Models::OAuth::Authorization.create(
25
+ account: session.account,
26
+ application: application
27
+ )
28
+ Core::Decorators::Authorization.new(authorization)
29
+ end
30
+
11
31
  # Gets the authorization code corresponding to the provided value if it is linked to the
12
32
  # application matching the provided credentials. Otherwise it raises errors.
13
33
  #
@@ -28,7 +28,7 @@ module Core
28
28
  account: account,
29
29
  token: SecureRandom.uuid
30
30
  )
31
- Decorators::Sessions.new(session)
31
+ Decorators::Session.new(session)
32
32
  end
33
33
 
34
34
  # Gets the session by its unique identifier.
data/lib/core/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Core
4
- VERSION = '1.6.0.dev3'
4
+ VERSION = '1.7.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virtuatable-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0.dev3
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Courtois
@@ -381,9 +381,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
381
381
  version: '0'
382
382
  required_rubygems_version: !ruby/object:Gem::Requirement
383
383
  requirements:
384
- - - ">"
384
+ - - ">="
385
385
  - !ruby/object:Gem::Version
386
- version: 1.3.1
386
+ version: '0'
387
387
  requirements: []
388
388
  rubygems_version: 3.2.3
389
389
  signing_key: