oktakit 1.0.0 → 1.1.0
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/.github/dependabot.yml +6 -0
- data/.github/workflows/ci.yml +5 -5
- data/.github/workflows/release.yml +70 -0
- data/.rubocop.yml +0 -1
- data/.ruby-version +1 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +74 -48
- data/README.md +5 -1
- data/dev.yml +1 -1
- data/lib/oktakit/client/admin_roles.rb +13 -9
- data/lib/oktakit/client/apps.rb +28 -21
- data/lib/oktakit/client/factors.rb +14 -13
- data/lib/oktakit/client/group_rules.rb +5 -5
- data/lib/oktakit/client/groups.rb +7 -7
- data/lib/oktakit/client/identity_providers.rb +13 -13
- data/lib/oktakit/client/schemas.rb +4 -4
- data/lib/oktakit/client/templates.rb +4 -4
- data/lib/oktakit/client/users.rb +20 -20
- data/lib/oktakit/client.rb +51 -1
- data/lib/oktakit/version.rb +1 -1
- data/oktakit.gemspec +5 -3
- metadata +10 -14
- data/CHANGELOG.md +0 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 81679c7021e11c6ee3e2a0f1366612b1bbed87103abbdf330419877c3b07032a
|
|
4
|
+
data.tar.gz: 55825fdd98c661f3b2fe29452ff441bf6eeabd096f51fa64a4d7050ca9176fab
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3d3bb048652c9cb5fd02433b819d881bcd58f516aadd899a3db0c3afac0fd62c9035e57f7e091fa0ea2bb24dfd3b0d3d3fd4dfcafc2638e147e3fe1555dca385
|
|
7
|
+
data.tar.gz: 275a1957f10d7eaeb682c6e518018f3635c43ff10e4dafd5f067431f95a32c87d68b9b83885d70bcfd3f18a5ec82697113d074f203bb5e6888633c74f21dbec7
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -3,10 +3,10 @@ name: CI
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
|
-
-
|
|
6
|
+
- main
|
|
7
7
|
pull_request:
|
|
8
8
|
branches:
|
|
9
|
-
-
|
|
9
|
+
- main
|
|
10
10
|
|
|
11
11
|
jobs:
|
|
12
12
|
build:
|
|
@@ -14,12 +14,12 @@ jobs:
|
|
|
14
14
|
name: Ruby ${{ matrix.ruby }}
|
|
15
15
|
strategy:
|
|
16
16
|
matrix:
|
|
17
|
-
ruby: [
|
|
17
|
+
ruby: ["3.3", "3.4", "4.0"]
|
|
18
18
|
steps:
|
|
19
19
|
- name: Check out code
|
|
20
|
-
uses: actions/checkout@
|
|
20
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
21
21
|
- name: Set up Ruby ${{ matrix.ruby }}
|
|
22
|
-
uses: ruby/setup-ruby@v1
|
|
22
|
+
uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0
|
|
23
23
|
with:
|
|
24
24
|
ruby-version: ${{ matrix.ruby }}
|
|
25
25
|
bundler-cache: true
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
name: Release gem on RubyGems.org and create GitHub release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v[0-9]+.[0-9]+.[0-9]+'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
release_gem:
|
|
10
|
+
name: Release gem on RubyGems.org
|
|
11
|
+
if: github.repository == 'Shopify/oktakit'
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: write
|
|
16
|
+
id-token: write
|
|
17
|
+
|
|
18
|
+
environment: release
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- name: Checkout repository
|
|
22
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
23
|
+
with:
|
|
24
|
+
fetch-depth: 0
|
|
25
|
+
persist-credentials: false
|
|
26
|
+
|
|
27
|
+
- name: Set up Ruby
|
|
28
|
+
uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0
|
|
29
|
+
with:
|
|
30
|
+
bundler-cache: true
|
|
31
|
+
|
|
32
|
+
- name: Validate release tag
|
|
33
|
+
env:
|
|
34
|
+
RELEASE_TAG: ${{ github.ref_name }}
|
|
35
|
+
run: |
|
|
36
|
+
git merge-base --is-ancestor HEAD origin/main || {
|
|
37
|
+
echo "::error::Release tags must point to a commit on main"
|
|
38
|
+
exit 1
|
|
39
|
+
}
|
|
40
|
+
ruby -Ilib -roktakit/version -e '
|
|
41
|
+
expected = "v#{Oktakit::VERSION}"
|
|
42
|
+
actual = ENV.fetch("RELEASE_TAG")
|
|
43
|
+
unless actual == expected
|
|
44
|
+
puts "::error::Release tag must be #{expected}, not #{actual}"
|
|
45
|
+
exit 1
|
|
46
|
+
end
|
|
47
|
+
'
|
|
48
|
+
|
|
49
|
+
- name: Release gem on RubyGems.org
|
|
50
|
+
uses: rubygems/release-gem@7f9650160c1a4e7989fdc9855807bdbd421d8b6b # v1.4.1
|
|
51
|
+
|
|
52
|
+
release_github:
|
|
53
|
+
name: Create GitHub release
|
|
54
|
+
if: github.repository == 'Shopify/oktakit'
|
|
55
|
+
needs: release_gem
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
|
|
58
|
+
permissions:
|
|
59
|
+
contents: write
|
|
60
|
+
|
|
61
|
+
steps:
|
|
62
|
+
- name: Checkout repository
|
|
63
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
64
|
+
|
|
65
|
+
- name: Create GitHub release
|
|
66
|
+
run: |
|
|
67
|
+
tag_name="$(git describe --tags --abbrev=0)"
|
|
68
|
+
gh release create "${tag_name}" --verify-tag --generate-notes
|
|
69
|
+
env:
|
|
70
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4.0.9
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,73 +1,99 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
oktakit (1.
|
|
4
|
+
oktakit (1.1.0)
|
|
5
5
|
faraday (>= 2.0.1, < 3)
|
|
6
6
|
sawyer (>= 0.8.1, < 0.10)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
addressable (2.
|
|
12
|
-
public_suffix (>= 2.0.2, <
|
|
13
|
-
ast (2.4.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
addressable (2.9.0)
|
|
12
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
13
|
+
ast (2.4.3)
|
|
14
|
+
base64 (0.3.0)
|
|
15
|
+
byebug (13.0.0)
|
|
16
|
+
reline (>= 0.6.0)
|
|
17
|
+
diff-lcs (1.6.2)
|
|
18
|
+
faraday (2.15.1)
|
|
19
|
+
faraday-net_http (>= 2.0, < 3.6)
|
|
20
|
+
json
|
|
21
|
+
logger
|
|
22
|
+
faraday-net_http (3.5.0)
|
|
23
|
+
net-http (~> 0.5)
|
|
24
|
+
io-console (0.9.4)
|
|
25
|
+
json (3.1.0)
|
|
26
|
+
language_server-protocol (3.17.0.6)
|
|
27
|
+
lint_roller (1.1.0)
|
|
28
|
+
logger (1.7.0)
|
|
29
|
+
net-http (0.10.0)
|
|
30
|
+
net-protocol (>= 0.3.0)
|
|
31
|
+
uri (>= 0.11.1)
|
|
32
|
+
net-protocol (0.4.0)
|
|
33
|
+
timeout
|
|
34
|
+
parallel (2.3.0)
|
|
35
|
+
parser (3.3.13.0)
|
|
22
36
|
ast (~> 2.4.1)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
rspec
|
|
33
|
-
rspec-
|
|
34
|
-
|
|
37
|
+
racc
|
|
38
|
+
prism (1.9.0)
|
|
39
|
+
public_suffix (7.0.5)
|
|
40
|
+
racc (1.8.1)
|
|
41
|
+
rainbow (3.1.1)
|
|
42
|
+
rake (13.4.2)
|
|
43
|
+
regexp_parser (2.13.1)
|
|
44
|
+
reline (0.7.0)
|
|
45
|
+
io-console (~> 0.5)
|
|
46
|
+
rspec (3.13.2)
|
|
47
|
+
rspec-core (~> 3.13.0)
|
|
48
|
+
rspec-expectations (~> 3.13.0)
|
|
49
|
+
rspec-mocks (~> 3.13.0)
|
|
50
|
+
rspec-core (3.13.6)
|
|
51
|
+
rspec-support (~> 3.13.0)
|
|
52
|
+
rspec-expectations (3.13.5)
|
|
35
53
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
36
|
-
rspec-support (~> 3.
|
|
37
|
-
rspec-mocks (3.
|
|
54
|
+
rspec-support (~> 3.13.0)
|
|
55
|
+
rspec-mocks (3.13.8)
|
|
38
56
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
39
|
-
rspec-support (~> 3.
|
|
40
|
-
rspec-support (3.
|
|
41
|
-
rubocop (1.
|
|
42
|
-
|
|
43
|
-
|
|
57
|
+
rspec-support (~> 3.13.0)
|
|
58
|
+
rspec-support (3.13.7)
|
|
59
|
+
rubocop (1.92.1)
|
|
60
|
+
json (>= 2.3)
|
|
61
|
+
language_server-protocol (~> 3.17.0.2)
|
|
62
|
+
lint_roller (~> 1.1.0)
|
|
63
|
+
parallel (>= 1.10)
|
|
64
|
+
parser (>= 3.3.0.2)
|
|
44
65
|
rainbow (>= 2.2.2, < 4.0)
|
|
45
|
-
regexp_parser (>=
|
|
46
|
-
|
|
47
|
-
rubocop-ast (>= 1.12.0, < 2.0)
|
|
66
|
+
regexp_parser (>= 2.11.3, < 3.0)
|
|
67
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
48
68
|
ruby-progressbar (~> 1.7)
|
|
49
|
-
unicode-display_width (>=
|
|
50
|
-
rubocop-ast (1.
|
|
51
|
-
parser (>= 3.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
69
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
70
|
+
rubocop-ast (1.50.0)
|
|
71
|
+
parser (>= 3.3.7.2)
|
|
72
|
+
prism (~> 1.7)
|
|
73
|
+
rubocop-shopify (3.1.0)
|
|
74
|
+
lint_roller
|
|
75
|
+
rubocop (~> 1.89)
|
|
76
|
+
ruby-progressbar (1.13.0)
|
|
77
|
+
sawyer (0.9.3)
|
|
57
78
|
addressable (>= 2.3.5)
|
|
58
79
|
faraday (>= 0.17.3, < 3)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
80
|
+
timeout (0.6.1)
|
|
81
|
+
unicode-display_width (3.3.0)
|
|
82
|
+
unicode-emoji (~> 4.3)
|
|
83
|
+
unicode-emoji (4.3.0)
|
|
84
|
+
uri (1.1.2)
|
|
85
|
+
vcr (6.4.0)
|
|
86
|
+
yard (0.9.45)
|
|
64
87
|
|
|
65
88
|
PLATFORMS
|
|
66
89
|
-darwin-21
|
|
67
90
|
arm64-darwin-21
|
|
91
|
+
arm64-darwin-24
|
|
92
|
+
ruby
|
|
68
93
|
x86_64-linux
|
|
69
94
|
|
|
70
95
|
DEPENDENCIES
|
|
96
|
+
base64
|
|
71
97
|
bundler
|
|
72
98
|
byebug
|
|
73
99
|
oktakit!
|
|
@@ -79,4 +105,4 @@ DEPENDENCIES
|
|
|
79
105
|
yard
|
|
80
106
|
|
|
81
107
|
BUNDLED WITH
|
|
82
|
-
|
|
108
|
+
4.0.20
|
data/README.md
CHANGED
|
@@ -47,7 +47,11 @@ response, http_status = client.list_users(paginate: true)
|
|
|
47
47
|
|
|
48
48
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
49
49
|
|
|
50
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
|
50
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
|
51
|
+
|
|
52
|
+
To release a new version, update the version number in `version.rb`, and merge the change to `main`. Then push a `vX.Y.Z` tag for that commit. The `Release` GitHub Actions workflow uses [trusted publishing](https://guides.rubygems.org/trusted-publishing/) to push the gem to [rubygems.org](https://rubygems.org), and then creates a GitHub release for the tag. The release notes list the merged pull requests.
|
|
53
|
+
|
|
54
|
+
The changes in each version are in the [GitHub releases](https://github.com/Shopify/oktakit/releases).
|
|
51
55
|
|
|
52
56
|
## Testing
|
|
53
57
|
|
data/dev.yml
CHANGED
|
@@ -14,7 +14,7 @@ module Oktakit
|
|
|
14
14
|
# @example
|
|
15
15
|
# Oktakit.list_roles_assigned_to_user('id')
|
|
16
16
|
def list_roles_assigned_to_user(id, options = {})
|
|
17
|
-
get("/users/#{id}/roles", options)
|
|
17
|
+
get("/users/#{path_segment(id)}/roles", options)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
# Assign Role to User
|
|
@@ -30,7 +30,7 @@ module Oktakit
|
|
|
30
30
|
# @example
|
|
31
31
|
# Oktakit.assign_role_to_user('id')
|
|
32
32
|
def assign_role_to_user(id, options = {})
|
|
33
|
-
post("/users/#{id}/roles", options)
|
|
33
|
+
post("/users/#{path_segment(id)}/roles", options)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
# Unassign Role from User
|
|
@@ -47,7 +47,7 @@ module Oktakit
|
|
|
47
47
|
# @example
|
|
48
48
|
# Oktakit.unassign_role_from_user('user_id', 'role_id')
|
|
49
49
|
def unassign_role_from_user(user_id, role_id, options = {})
|
|
50
|
-
delete("/users/#{user_id}/roles/#{role_id}", options)
|
|
50
|
+
delete("/users/#{path_segment(user_id)}/roles/#{path_segment(role_id)}", options)
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
# List Group Targets for User Admin Role
|
|
@@ -64,7 +64,7 @@ module Oktakit
|
|
|
64
64
|
# @example
|
|
65
65
|
# Oktakit.list_group_targets_for_user_admin_role('user_id', 'role_id')
|
|
66
66
|
def list_group_targets_for_user_admin_role(user_id, role_id, options = {})
|
|
67
|
-
get("/users/#{user_id}/roles/#{role_id}/targets/groups", options)
|
|
67
|
+
get("/users/#{path_segment(user_id)}/roles/#{path_segment(role_id)}/targets/groups", options)
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
# Add Group Target to User Admin Role
|
|
@@ -82,7 +82,8 @@ module Oktakit
|
|
|
82
82
|
# @example
|
|
83
83
|
# Oktakit.add_group_target_to_user_admin_role('group_id', 'user_id', 'role_id')
|
|
84
84
|
def add_group_target_to_user_admin_role(user_id, role_id, group_id, options = {})
|
|
85
|
-
|
|
85
|
+
role = "/users/#{path_segment(user_id)}/roles/#{path_segment(role_id)}"
|
|
86
|
+
put("#{role}/targets/groups/#{path_segment(group_id)}", options)
|
|
86
87
|
end
|
|
87
88
|
|
|
88
89
|
# Remove Group Target from User Admin Role
|
|
@@ -100,7 +101,8 @@ module Oktakit
|
|
|
100
101
|
# @example
|
|
101
102
|
# Oktakit.remove_group_target_from_user_admin_role('group_id', 'user_id', 'role_id')
|
|
102
103
|
def remove_group_target_from_user_admin_role(user_id, role_id, group_id, options = {})
|
|
103
|
-
|
|
104
|
+
role = "/users/#{path_segment(user_id)}/roles/#{path_segment(role_id)}"
|
|
105
|
+
delete("#{role}/targets/groups/#{path_segment(group_id)}", options)
|
|
104
106
|
end
|
|
105
107
|
|
|
106
108
|
# List App Targets for App Admin Role
|
|
@@ -117,7 +119,7 @@ module Oktakit
|
|
|
117
119
|
# @example
|
|
118
120
|
# Oktakit.list_app_targets_for_app_admin_role('user_id', 'role_id')
|
|
119
121
|
def list_app_targets_for_app_admin_role(user_id, role_id, options = {})
|
|
120
|
-
get("/users/#{user_id}/roles/#{role_id}/targets/catalog/apps", options)
|
|
122
|
+
get("/users/#{path_segment(user_id)}/roles/#{path_segment(role_id)}/targets/catalog/apps", options)
|
|
121
123
|
end
|
|
122
124
|
|
|
123
125
|
# Add App Target to App Admin Role
|
|
@@ -135,7 +137,8 @@ module Oktakit
|
|
|
135
137
|
# @example
|
|
136
138
|
# Oktakit.add_app_target_to_app_admin_role('user_id', 'role_id')
|
|
137
139
|
def add_app_target_to_app_admin_role(user_id, role_id, app_name, options = {})
|
|
138
|
-
|
|
140
|
+
role = "/users/#{path_segment(user_id)}/roles/#{path_segment(role_id)}"
|
|
141
|
+
put("#{role}/targets/catalog/apps/#{path_segment(app_name)}", options)
|
|
139
142
|
end
|
|
140
143
|
|
|
141
144
|
# Remove App Target from App Admin Role
|
|
@@ -153,7 +156,8 @@ module Oktakit
|
|
|
153
156
|
# @example
|
|
154
157
|
# Oktakit.remove_app_target_from_app_admin_role('user_id', 'role_id')
|
|
155
158
|
def remove_app_target_from_app_admin_role(user_id, role_id, app_name, options = {})
|
|
156
|
-
|
|
159
|
+
role = "/users/#{path_segment(user_id)}/roles/#{path_segment(role_id)}"
|
|
160
|
+
delete("#{role}/targets/catalog/apps/#{path_segment(app_name)}", options)
|
|
157
161
|
end
|
|
158
162
|
end
|
|
159
163
|
end
|
data/lib/oktakit/client/apps.rb
CHANGED
|
@@ -29,7 +29,7 @@ module Oktakit
|
|
|
29
29
|
# @example
|
|
30
30
|
# Oktakit.get_application('id')
|
|
31
31
|
def get_application(id, options = {})
|
|
32
|
-
get("/apps/#{id}", options)
|
|
32
|
+
get("/apps/#{path_segment(id)}", options)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
# List Applications
|
|
@@ -60,7 +60,7 @@ module Oktakit
|
|
|
60
60
|
# @example
|
|
61
61
|
# Oktakit.update_application('id')
|
|
62
62
|
def update_application(id, options = {})
|
|
63
|
-
put("/apps/#{id}", options)
|
|
63
|
+
put("/apps/#{path_segment(id)}", options)
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
# Delete Application
|
|
@@ -76,7 +76,7 @@ module Oktakit
|
|
|
76
76
|
# @example
|
|
77
77
|
# Oktakit.delete_application('id')
|
|
78
78
|
def delete_application(id, options = {})
|
|
79
|
-
delete("/apps/#{id}", options)
|
|
79
|
+
delete("/apps/#{path_segment(id)}", options)
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
# Activate Application
|
|
@@ -92,7 +92,7 @@ module Oktakit
|
|
|
92
92
|
# @example
|
|
93
93
|
# Oktakit.activate_application('id')
|
|
94
94
|
def activate_application(id, options = {})
|
|
95
|
-
post("/apps/#{id}/lifecycle/activate", options)
|
|
95
|
+
post("/apps/#{path_segment(id)}/lifecycle/activate", options)
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
# Deactivate Application
|
|
@@ -108,7 +108,7 @@ module Oktakit
|
|
|
108
108
|
# @example
|
|
109
109
|
# Oktakit.deactivate_application('id')
|
|
110
110
|
def deactivate_application(id, options = {})
|
|
111
|
-
post("/apps/#{id}/lifecycle/deactivate", options)
|
|
111
|
+
post("/apps/#{path_segment(id)}/lifecycle/deactivate", options)
|
|
112
112
|
end
|
|
113
113
|
|
|
114
114
|
# Assign User to Application for SSO
|
|
@@ -124,7 +124,7 @@ module Oktakit
|
|
|
124
124
|
# @example
|
|
125
125
|
# Oktakit.assign_user_to_application_for_sso('id')
|
|
126
126
|
def assign_user_to_application_for_sso(id, options = {})
|
|
127
|
-
post("/apps/#{id}/users", options)
|
|
127
|
+
post("/apps/#{path_segment(id)}/users", options)
|
|
128
128
|
end
|
|
129
129
|
|
|
130
130
|
# Assign User to Application for SSO & Provisioning
|
|
@@ -140,7 +140,7 @@ module Oktakit
|
|
|
140
140
|
# @example
|
|
141
141
|
# Oktakit.assign_user_to_application_for_sso_provisioning('id')
|
|
142
142
|
def assign_user_to_application_for_sso_provisioning(id, options = {})
|
|
143
|
-
post("/apps/#{id}/users", options)
|
|
143
|
+
post("/apps/#{path_segment(id)}/users", options)
|
|
144
144
|
end
|
|
145
145
|
|
|
146
146
|
# Get Assigned User for Application
|
|
@@ -157,7 +157,7 @@ module Oktakit
|
|
|
157
157
|
# @example
|
|
158
158
|
# Oktakit.get_assigned_user_for_application('user_id', 'app_id')
|
|
159
159
|
def get_assigned_user_for_application(app_id, user_id, options = {})
|
|
160
|
-
get("/apps/#{app_id}/users/#{user_id}", options)
|
|
160
|
+
get("/apps/#{path_segment(app_id)}/users/#{path_segment(user_id)}", options)
|
|
161
161
|
end
|
|
162
162
|
|
|
163
163
|
# List Users Assigned to Application
|
|
@@ -173,7 +173,7 @@ module Oktakit
|
|
|
173
173
|
# @example
|
|
174
174
|
# Oktakit.list_users_assigned_to_application('id')
|
|
175
175
|
def list_users_assigned_to_application(id, options = {})
|
|
176
|
-
get("/apps/#{id}/users", options)
|
|
176
|
+
get("/apps/#{path_segment(id)}/users", options)
|
|
177
177
|
end
|
|
178
178
|
|
|
179
179
|
# List Applications Assigned to User
|
|
@@ -189,7 +189,14 @@ module Oktakit
|
|
|
189
189
|
# @example
|
|
190
190
|
# Oktakit.list_applications_assigned_to_user('<user_id>')
|
|
191
191
|
def list_applications_assigned_to_user(user_id, options = {})
|
|
192
|
-
|
|
192
|
+
id = user_id.to_s
|
|
193
|
+
raise ArgumentError, "Invalid user ID: #{user_id.inspect}" if id.empty?
|
|
194
|
+
|
|
195
|
+
# Okta filter string literals must be valid JSON strings, so to_json escapes quotes and backslashes.
|
|
196
|
+
# The filter and expand values here always win over any caller-supplied ones.
|
|
197
|
+
query = (options[:query] || {}).reject { |key, _| ["filter", "expand"].include?(key.to_s) }
|
|
198
|
+
query = query.merge(filter: "user.id eq #{id.to_json}", expand: "user/#{id}")
|
|
199
|
+
get("/apps", options.merge(query: query))
|
|
193
200
|
end
|
|
194
201
|
|
|
195
202
|
# Update Application Credentials for Assigned User
|
|
@@ -206,7 +213,7 @@ module Oktakit
|
|
|
206
213
|
# @example
|
|
207
214
|
# Oktakit.update_application_credentials_for_assigned_user('user_id', 'app_id')
|
|
208
215
|
def update_application_credentials_for_assigned_user(app_id, user_id, options = {})
|
|
209
|
-
post("/apps/#{app_id}/users/#{user_id}", options)
|
|
216
|
+
post("/apps/#{path_segment(app_id)}/users/#{path_segment(user_id)}", options)
|
|
210
217
|
end
|
|
211
218
|
|
|
212
219
|
# Update Application Profile for Assigned User
|
|
@@ -223,7 +230,7 @@ module Oktakit
|
|
|
223
230
|
# @example
|
|
224
231
|
# Oktakit.update_application_profile_for_assigned_user('user_id', 'app_id')
|
|
225
232
|
def update_application_profile_for_assigned_user(app_id, user_id, options = {})
|
|
226
|
-
post("/apps/#{app_id}/users/#{user_id}", options)
|
|
233
|
+
post("/apps/#{path_segment(app_id)}/users/#{path_segment(user_id)}", options)
|
|
227
234
|
end
|
|
228
235
|
|
|
229
236
|
# Remove User from Application
|
|
@@ -240,7 +247,7 @@ module Oktakit
|
|
|
240
247
|
# @example
|
|
241
248
|
# Oktakit.remove_user_from_application('user_id', 'app_id')
|
|
242
249
|
def remove_user_from_application(app_id, user_id, options = {})
|
|
243
|
-
delete("/apps/#{app_id}/users/#{user_id}", options)
|
|
250
|
+
delete("/apps/#{path_segment(app_id)}/users/#{path_segment(user_id)}", options)
|
|
244
251
|
end
|
|
245
252
|
|
|
246
253
|
# Assign Group to Application
|
|
@@ -257,7 +264,7 @@ module Oktakit
|
|
|
257
264
|
# @example
|
|
258
265
|
# Oktakit.assign_group_to_application('group_id', 'app_id')
|
|
259
266
|
def assign_group_to_application(app_id, group_id, options = {})
|
|
260
|
-
put("/apps/#{app_id}/groups/#{group_id}", options)
|
|
267
|
+
put("/apps/#{path_segment(app_id)}/groups/#{path_segment(group_id)}", options)
|
|
261
268
|
end
|
|
262
269
|
|
|
263
270
|
# Get Assigned Group for Application
|
|
@@ -274,7 +281,7 @@ module Oktakit
|
|
|
274
281
|
# @example
|
|
275
282
|
# Oktakit.get_assigned_group_for_application('group_id', 'app_id')
|
|
276
283
|
def get_assigned_group_for_application(app_id, group_id, options = {})
|
|
277
|
-
get("/apps/#{app_id}/groups/#{group_id}", options)
|
|
284
|
+
get("/apps/#{path_segment(app_id)}/groups/#{path_segment(group_id)}", options)
|
|
278
285
|
end
|
|
279
286
|
|
|
280
287
|
# List Groups Assigned to Application
|
|
@@ -290,7 +297,7 @@ module Oktakit
|
|
|
290
297
|
# @example
|
|
291
298
|
# Oktakit.list_groups_assigned_to_application('id')
|
|
292
299
|
def list_groups_assigned_to_application(id, options = {})
|
|
293
|
-
get("/apps/#{id}/groups", options)
|
|
300
|
+
get("/apps/#{path_segment(id)}/groups", options)
|
|
294
301
|
end
|
|
295
302
|
|
|
296
303
|
# Remove Group from Application
|
|
@@ -307,7 +314,7 @@ module Oktakit
|
|
|
307
314
|
# @example
|
|
308
315
|
# Oktakit.remove_group_from_application('group_id', 'app_id')
|
|
309
316
|
def remove_group_from_application(app_id, group_id, options = {})
|
|
310
|
-
delete("/apps/#{app_id}/groups/#{group_id}", options)
|
|
317
|
+
delete("/apps/#{path_segment(app_id)}/groups/#{path_segment(group_id)}", options)
|
|
311
318
|
end
|
|
312
319
|
|
|
313
320
|
# Generate New Application Key Credential
|
|
@@ -323,7 +330,7 @@ module Oktakit
|
|
|
323
330
|
# @example
|
|
324
331
|
# Oktakit.generate_new_application_key_credential('app_id')
|
|
325
332
|
def generate_new_application_key_credential(app_id, options = {})
|
|
326
|
-
post("/apps/#{app_id}/credentials/keys/generate", options)
|
|
333
|
+
post("/apps/#{path_segment(app_id)}/credentials/keys/generate", options)
|
|
327
334
|
end
|
|
328
335
|
|
|
329
336
|
# List Key Credentials for Application
|
|
@@ -339,7 +346,7 @@ module Oktakit
|
|
|
339
346
|
# @example
|
|
340
347
|
# Oktakit.list_key_credentials_for_application('app_id')
|
|
341
348
|
def list_key_credentials_for_application(app_id, options = {})
|
|
342
|
-
get("/apps/#{app_id}/credentials/keys", options)
|
|
349
|
+
get("/apps/#{path_segment(app_id)}/credentials/keys", options)
|
|
343
350
|
end
|
|
344
351
|
|
|
345
352
|
# Get Key Credential for Application
|
|
@@ -356,7 +363,7 @@ module Oktakit
|
|
|
356
363
|
# @example
|
|
357
364
|
# Oktakit.get_key_credential_for_application('app_id', 'key_id')
|
|
358
365
|
def get_key_credential_for_application(app_id, key_id, options = {})
|
|
359
|
-
get("/apps/#{app_id}/credentials/keys/#{key_id}", options)
|
|
366
|
+
get("/apps/#{path_segment(app_id)}/credentials/keys/#{path_segment(key_id)}", options)
|
|
360
367
|
end
|
|
361
368
|
|
|
362
369
|
# Preview SAML metadata for Application
|
|
@@ -372,7 +379,7 @@ module Oktakit
|
|
|
372
379
|
# @example
|
|
373
380
|
# Oktakit.preview_saml_metadata_for_application('app_id')
|
|
374
381
|
def preview_saml_metadata_for_application(app_id, options = {})
|
|
375
|
-
get("/apps/#{app_id}/sso/saml/metadata", options)
|
|
382
|
+
get("/apps/#{path_segment(app_id)}/sso/saml/metadata", options)
|
|
376
383
|
end
|
|
377
384
|
end
|
|
378
385
|
end
|