decidim-ub 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -1
- data/lib/decidim/ub/version.rb +1 -1
- data/lib/omniauth/strategies/ub.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7a6641e87be62bae1a4e3e5966fdc8f2cfa1a2d562b65afca781e0b858d30e8
|
4
|
+
data.tar.gz: 55acc9758bd959e61c64c7978adde379880c6e9754eb911b5e34c4a08599e254
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c6310ad728cb3a04148091acdcddf2e9c609bb92908d26b4afa2a9375ab431b826f46fb68bca9dcb197dce90e038041ac6b753c9df1a90c0798a03b6583eeb9
|
7
|
+
data.tar.gz: 9d36892dc92947731683452a26d4d67a6eb1cd758872bd596e3b50a58023c72e712f41026f5c3dc4fb78ce017ab9a1e8e476ac839fb9badd10b8595f8d2b51af
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Decidim::Ub
|
2
2
|
|
3
|
+
[![Gem Version](https://img.shields.io/gem/v/decidim-ub.svg)](https://badge.fury.io/rb/decidim-ub)
|
3
4
|
[![[CI] Lint](https://github.com/Platoniq/decidim-module-ub/actions/workflows/lint.yml/badge.svg)](https://github.com/Platoniq/decidim-module-ub/actions/workflows/lint.yml)
|
4
5
|
[![[CI] Test](https://github.com/Platoniq/decidim-module-ub/actions/workflows/test.yml/badge.svg)](https://github.com/Platoniq/decidim-module-ub/actions/workflows/test.yml)
|
5
6
|
[![Maintainability](https://api.codeclimate.com/v1/badges/c975a347c58389448503/maintainability)](https://codeclimate.com/github/Platoniq/decidim-module-ub/maintainability)
|
@@ -12,7 +13,7 @@ A Decidim module to sync users from Universitat de Barcelona who connect to the
|
|
12
13
|
Add this line to your application's Gemfile:
|
13
14
|
|
14
15
|
```ruby
|
15
|
-
gem "decidim-ub"
|
16
|
+
gem "decidim-ub"
|
16
17
|
```
|
17
18
|
|
18
19
|
And then execute:
|
@@ -36,6 +37,22 @@ You need to configure some environment variables for the OAuth client:
|
|
36
37
|
| UB_TOKEN_URL | The path for the token URL | `/token` | |
|
37
38
|
| UB_ICON | The path for the icon shown in the button | `media/images/my_icon.svg` | `media/images/ub_logo.svg` |
|
38
39
|
|
40
|
+
If you set the variables you don't see the OAuth button in the organization, you will need to create an initializer to configure this module. Just create a file in `config/initializers/decidim_ub.rb` with the content below:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
Decidim::Ub.configure do |config|
|
44
|
+
config.omniauth = {
|
45
|
+
enabled: ENV["UB_CLIENT_ID"].present?,
|
46
|
+
icon_path: ENV.fetch("UB_ICON", "media/images/ub_logo.svg"),
|
47
|
+
client_id: ENV["UB_CLIENT_ID"].presence,
|
48
|
+
client_secret: ENV["UB_CLIENT_SECRET"].presence,
|
49
|
+
site: ENV["UB_SITE"].presence,
|
50
|
+
authorize_url: ENV["UB_AUTHORIZE_URL"].presence,
|
51
|
+
token_url: ENV["UB_TOKEN_URL"].presence
|
52
|
+
}
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
39
56
|
## Contributing
|
40
57
|
|
41
58
|
Contributions are welcome !
|
data/lib/decidim/ub/version.rb
CHANGED
@@ -30,7 +30,7 @@ module OmniAuth
|
|
30
30
|
def raw_info
|
31
31
|
@raw_info ||= begin
|
32
32
|
connection = Faraday.new(url: options.client_options[:site], ssl: { verify: true }) do |conn|
|
33
|
-
conn.headers["Authorization"] =
|
33
|
+
conn.headers["Authorization"] = access_token.options[:header_format].gsub("%s", access_token.token)
|
34
34
|
end
|
35
35
|
response = connection.get("/api/adas/oauth2/tokendata")
|
36
36
|
raise Error, "Unable to fetch the user information" unless response.success?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-ub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francisco Bolívar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: decidim-core
|