strongdm 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/LICENSE.html +45 -136
- data/doc/Object.html +300 -105
- data/doc/README_md.html +15 -7
- data/doc/SDM.html +16 -24
- data/doc/SDM/AKS.html +113 -51
- data/doc/SDM/AKSBasicAuth.html +93 -35
- data/doc/SDM/AKSServiceAccount.html +88 -31
- data/doc/SDM/AccountAttachment.html +77 -27
- data/doc/SDM/AccountAttachmentCreateOptions.html +62 -13
- data/doc/SDM/AccountAttachmentCreateResponse.html +75 -24
- data/doc/SDM/AccountAttachmentDeleteResponse.html +69 -19
- data/doc/SDM/AccountAttachmentGetResponse.html +75 -23
- data/doc/SDM/AccountAttachments.html +42 -39
- data/doc/SDM/AccountCreateResponse.html +80 -27
- data/doc/SDM/AccountDeleteResponse.html +69 -17
- data/doc/SDM/AccountGetResponse.html +74 -21
- data/doc/SDM/AccountGrant.html +89 -39
- data/doc/SDM/AccountGrantCreateResponse.html +75 -23
- data/doc/SDM/AccountGrantDeleteResponse.html +69 -18
- data/doc/SDM/AccountGrantGetResponse.html +75 -22
- data/doc/SDM/AccountGrants.html +41 -36
- data/doc/SDM/AccountUpdateResponse.html +74 -21
- data/doc/SDM/Accounts.html +45 -39
- data/doc/SDM/AlreadyExistsError.html +13 -10
- data/doc/SDM/AmazonEKS.html +108 -47
- data/doc/SDM/AmazonES.html +98 -39
- data/doc/SDM/Athena.html +98 -39
- data/doc/SDM/AuroraMysql.html +103 -43
- data/doc/SDM/AuroraPostgres.html +108 -47
- data/doc/SDM/AuthenticationError.html +13 -10
- data/doc/SDM/BadRequestError.html +13 -10
- data/doc/SDM/BigQuery.html +98 -39
- data/doc/SDM/Cassandra.html +103 -43
- data/doc/SDM/Client.html +29 -48
- data/doc/SDM/Clustrix.html +103 -43
- data/doc/SDM/Cockroach.html +108 -47
- data/doc/SDM/CreateResponseMetadata.html +59 -9
- data/doc/SDM/DeadlineExceededError.html +13 -10
- data/doc/SDM/DeleteResponseMetadata.html +60 -10
- data/doc/SDM/Druid.html +98 -39
- data/doc/SDM/DynamoDB.html +98 -39
- data/doc/SDM/Elastic.html +103 -43
- data/doc/SDM/ElasticacheRedis.html +98 -39
- data/doc/SDM/Gateway.html +89 -38
- data/doc/SDM/GetResponseMetadata.html +60 -10
- data/doc/SDM/GoogleGKE.html +98 -39
- data/doc/SDM/Greenplum.html +108 -47
- data/doc/SDM/HTTPAuth.html +103 -43
- data/doc/SDM/HTTPBasicAuth.html +108 -47
- data/doc/SDM/HTTPNoAuth.html +98 -39
- data/doc/SDM/InternalError.html +13 -10
- data/doc/SDM/Kubernetes.html +113 -51
- data/doc/SDM/KubernetesBasicAuth.html +93 -35
- data/doc/SDM/KubernetesServiceAccount.html +88 -31
- data/doc/SDM/Maria.html +103 -43
- data/doc/SDM/Memcached.html +88 -31
- data/doc/SDM/Memsql.html +103 -43
- data/doc/SDM/MongoHost.html +108 -47
- data/doc/SDM/MongoLegacyHost.html +113 -51
- data/doc/SDM/MongoLegacyReplicaset.html +118 -55
- data/doc/SDM/MongoReplicaSet.html +118 -55
- data/doc/SDM/Mysql.html +103 -43
- data/doc/SDM/NodeCreateResponse.html +80 -27
- data/doc/SDM/NodeDeleteResponse.html +69 -17
- data/doc/SDM/NodeGetResponse.html +74 -21
- data/doc/SDM/NodeUpdateResponse.html +74 -21
- data/doc/SDM/Nodes.html +46 -41
- data/doc/SDM/NotFoundError.html +13 -10
- data/doc/SDM/Oracle.html +108 -47
- data/doc/SDM/PermissionError.html +13 -10
- data/doc/SDM/Plumbing.html +375 -371
- data/doc/SDM/Postgres.html +108 -47
- data/doc/SDM/Presto.html +108 -47
- data/doc/SDM/RDP.html +98 -39
- data/doc/SDM/RPCError.html +12 -8
- data/doc/SDM/RateLimitError.html +13 -10
- data/doc/SDM/RateLimitMetadata.html +81 -29
- data/doc/SDM/Redis.html +93 -35
- data/doc/SDM/Redshift.html +108 -47
- data/doc/SDM/Relay.html +77 -26
- data/doc/SDM/ResourceCreateResponse.html +74 -21
- data/doc/SDM/ResourceDeleteResponse.html +69 -17
- data/doc/SDM/ResourceGetResponse.html +74 -21
- data/doc/SDM/ResourceUpdateResponse.html +74 -22
- data/doc/SDM/Resources.html +43 -35
- data/doc/SDM/Role.html +77 -26
- data/doc/SDM/RoleAttachment.html +77 -26
- data/doc/SDM/RoleAttachmentCreateResponse.html +75 -24
- data/doc/SDM/RoleAttachmentDeleteResponse.html +69 -19
- data/doc/SDM/RoleAttachmentGetResponse.html +75 -22
- data/doc/SDM/RoleAttachments.html +41 -38
- data/doc/SDM/RoleCreateResponse.html +75 -23
- data/doc/SDM/RoleDeleteResponse.html +69 -17
- data/doc/SDM/RoleGetResponse.html +75 -22
- data/doc/SDM/RoleGrant.html +77 -24
- data/doc/SDM/RoleGrantCreateResponse.html +75 -23
- data/doc/SDM/RoleGrantDeleteResponse.html +69 -18
- data/doc/SDM/RoleGrantGetResponse.html +75 -22
- data/doc/SDM/RoleGrants.html +41 -38
- data/doc/SDM/RoleUpdateResponse.html +75 -23
- data/doc/SDM/Roles.html +48 -46
- data/doc/SDM/SQLServer.html +113 -51
- data/doc/SDM/SSH.html +98 -39
- data/doc/SDM/Service.html +76 -24
- data/doc/SDM/Snowflake.html +103 -43
- data/doc/SDM/Sybase.html +98 -39
- data/doc/SDM/SybaseIQ.html +98 -39
- data/doc/SDM/Teradata.html +98 -39
- data/doc/SDM/UpdateResponseMetadata.html +60 -10
- data/doc/SDM/User.html +85 -30
- data/doc/V1.html +10 -6
- data/doc/V1/AccountAttachments.html +10 -6
- data/doc/V1/AccountAttachments/Service.html +11 -8
- data/doc/V1/AccountGrants.html +10 -6
- data/doc/V1/AccountGrants/Service.html +11 -9
- data/doc/V1/Accounts.html +10 -6
- data/doc/V1/Accounts/Service.html +12 -10
- data/doc/V1/Nodes.html +10 -6
- data/doc/V1/Nodes/Service.html +13 -13
- data/doc/V1/Resources.html +10 -6
- data/doc/V1/Resources/Service.html +10 -6
- data/doc/V1/RoleAttachments.html +10 -6
- data/doc/V1/RoleAttachments/Service.html +11 -11
- data/doc/V1/RoleGrants.html +10 -6
- data/doc/V1/RoleGrants/Service.html +11 -11
- data/doc/V1/Roles.html +10 -6
- data/doc/V1/Roles/Service.html +11 -12
- data/doc/created.rid +41 -37
- data/doc/css/fonts.css +6 -6
- data/doc/css/rdoc.css +22 -1
- data/doc/examples/Gemfile.html +14 -4
- data/doc/examples/Gemfile_lock.html +14 -4
- data/doc/examples/README_md.html +14 -4
- data/doc/examples/okta-sync/Gemfile.html +105 -0
- data/doc/examples/okta-sync/Gemfile_lock.html +146 -0
- data/doc/index.html +15 -8
- data/doc/js/darkfish.js +23 -100
- data/doc/js/navigation.js +4 -41
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search.js +32 -31
- data/doc/js/search_index.js +1 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +7 -6
- data/doc/js/searcher.js.gz +0 -0
- data/doc/lib/version.html +16 -6
- data/doc/strongdm_gemspec.html +15 -5
- data/doc/table_of_contents.html +981 -260
- data/examples/Gemfile +2 -2
- data/examples/listUsers.rb +8 -8
- data/examples/okta-sync/Gemfile +4 -0
- data/examples/okta-sync/Gemfile.lock +38 -0
- data/examples/okta-sync/matchers.yml +11 -0
- data/examples/okta-sync/oktaSync.rb +173 -0
- data/examples/panicButton.rb +103 -119
- data/lib/errors/errors.rb +55 -53
- data/lib/grpc/account_attachments_pb.rb +9 -9
- data/lib/grpc/account_attachments_services_pb.rb +7 -8
- data/lib/grpc/account_grants_pb.rb +10 -10
- data/lib/grpc/account_grants_services_pb.rb +7 -8
- data/lib/grpc/accounts_pb.rb +9 -9
- data/lib/grpc/accounts_services_pb.rb +7 -8
- data/lib/grpc/drivers_pb.rb +7 -7
- data/lib/grpc/nodes_pb.rb +9 -9
- data/lib/grpc/nodes_services_pb.rb +7 -8
- data/lib/grpc/options_pb.rb +5 -5
- data/lib/grpc/plumbing.rb +4083 -4084
- data/lib/grpc/protoc-gen-swagger/options/annotations_pb.rb +4 -4
- data/lib/grpc/resources_pb.rb +9 -9
- data/lib/grpc/resources_services_pb.rb +7 -8
- data/lib/grpc/role_attachments_pb.rb +9 -9
- data/lib/grpc/role_attachments_services_pb.rb +7 -8
- data/lib/grpc/role_grants_pb.rb +9 -9
- data/lib/grpc/role_grants_services_pb.rb +7 -8
- data/lib/grpc/roles_pb.rb +9 -9
- data/lib/grpc/roles_services_pb.rb +7 -8
- data/lib/grpc/spec_pb.rb +8 -8
- data/lib/models/porcelain.rb +4409 -4017
- data/lib/strongdm.rb +94 -95
- data/lib/svc.rb +1202 -1224
- data/lib/version +1 -1
- data/lib/version.rb +6 -6
- data/strongdm.gemspec +10 -10
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e52f4868813476da740349095c7e130ef595894f3174b9a1ec26a0b9d9e8c515
|
4
|
+
data.tar.gz: 8d6550036b3bcb59dfe84d304da375bd91d34808e92f6d53918e24d709db19ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67aa4c5a0f3a6ca8c21a3fbe8aba455ca171866f2d4bb4dd26c93f4bc2f2392b484f49ae4fcfe640b455fac2bd384526ecf159c001625be2482245d9fc3918d1
|
7
|
+
data.tar.gz: b34b1e5c819bf50092aebcc7f8736fc4402be787a71bae244988544facbd3fd8331241f27c12c7774b86421ef8976d9476e6eda85e1056095efd4603d1df062a
|
data/doc/LICENSE.html
CHANGED
@@ -8,16 +8,21 @@
|
|
8
8
|
|
9
9
|
<script type="text/javascript">
|
10
10
|
var rdoc_rel_prefix = "./";
|
11
|
+
var index_rel_prefix = "./";
|
11
12
|
</script>
|
12
13
|
|
13
|
-
<script src="./js/
|
14
|
-
<script src="./js/
|
14
|
+
<script src="./js/navigation.js" defer></script>
|
15
|
+
<script src="./js/search.js" defer></script>
|
16
|
+
<script src="./js/search_index.js" defer></script>
|
17
|
+
<script src="./js/searcher.js" defer></script>
|
18
|
+
<script src="./js/darkfish.js" defer></script>
|
15
19
|
|
16
20
|
<link href="./css/fonts.css" rel="stylesheet">
|
17
21
|
<link href="./css/rdoc.css" rel="stylesheet">
|
18
22
|
|
19
23
|
|
20
24
|
|
25
|
+
|
21
26
|
<body id="top" role="document" class="file">
|
22
27
|
<nav role="navigation">
|
23
28
|
<div id="project-navigation">
|
@@ -68,6 +73,10 @@
|
|
68
73
|
|
69
74
|
<li><a href="./examples/README_md.html">README</a>
|
70
75
|
|
76
|
+
<li><a href="./examples/okta-sync/Gemfile.html">Gemfile</a>
|
77
|
+
|
78
|
+
<li><a href="./examples/okta-sync/Gemfile_lock.html">Gemfile.lock</a>
|
79
|
+
|
71
80
|
<li><a href="./lib/version.html">version</a>
|
72
81
|
|
73
82
|
<li><a href="./strongdm_gemspec.html">strongdm.gemspec</a>
|
@@ -88,88 +97,31 @@ http://www.apache.org/licenses/</pre>
|
|
88
97
|
<ol><li>
|
89
98
|
<p>Definitions.</p>
|
90
99
|
|
91
|
-
<p>“License” shall mean the terms and conditions for use, reproduction, and
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
<p>“
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
<p>“
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
and configuration files.</p>
|
111
|
-
|
112
|
-
<p>“Object” form shall mean any form resulting from mechanical transformation
|
113
|
-
or translation of a Source form, including but not limited to compiled
|
114
|
-
object code, generated documentation, and conversions to other media types.</p>
|
115
|
-
|
116
|
-
<p>“Work” shall mean the work of authorship, whether in Source or <a
|
117
|
-
href="Object.html">Object</a> form, made available under the License, as
|
118
|
-
indicated by a copyright notice that is included in or attached to the work
|
119
|
-
(an example is provided in the Appendix below).</p>
|
120
|
-
|
121
|
-
<p>“Derivative Works” shall mean any work, whether in Source or <a
|
122
|
-
href="Object.html">Object</a> form, that is based on (or derived from) the
|
123
|
-
Work and for which the editorial revisions, annotations, elaborations, or
|
124
|
-
other modifications represent, as a whole, an original work of authorship.
|
125
|
-
For the purposes of this License, Derivative Works shall not include works
|
126
|
-
that remain separable from, or merely link (or bind by name) to the
|
127
|
-
interfaces of, the Work and Derivative Works thereof.</p>
|
128
|
-
|
129
|
-
<p>“Contribution” shall mean any work of authorship, including the original
|
130
|
-
version of the Work and any modifications or additions to that Work or
|
131
|
-
Derivative Works thereof, that is intentionally submitted to Licensor for
|
132
|
-
inclusion in the Work by the copyright owner or by an individual or Legal
|
133
|
-
Entity authorized to submit on behalf of the copyright owner. For the
|
134
|
-
purposes of this definition, “submitted” means any form of electronic,
|
135
|
-
verbal, or written communication sent to the Licensor or its
|
136
|
-
representatives, including but not limited to communication on electronic
|
137
|
-
mailing lists, source code control systems, and issue tracking systems that
|
138
|
-
are managed by, or on behalf of, the Licensor for the purpose of discussing
|
139
|
-
and improving the Work, but excluding communication that is conspicuously
|
140
|
-
marked or otherwise designated in writing by the copyright owner as “Not a
|
141
|
-
Contribution.”</p>
|
142
|
-
|
143
|
-
<p>“Contributor” shall mean Licensor and any individual or Legal Entity on
|
144
|
-
behalf of whom a Contribution has been received by Licensor and
|
145
|
-
subsequently incorporated within the Work.</p>
|
100
|
+
<p>“License” shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.</p>
|
101
|
+
|
102
|
+
<p>“Licensor” shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.</p>
|
103
|
+
|
104
|
+
<p>“Legal Entity” shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, “control” means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.</p>
|
105
|
+
|
106
|
+
<p>“You” (or “Your”) shall mean an individual or Legal Entity exercising permissions granted by this License.</p>
|
107
|
+
|
108
|
+
<p>“Source” form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.</p>
|
109
|
+
|
110
|
+
<p>“Object” form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.</p>
|
111
|
+
|
112
|
+
<p>“Work” shall mean the work of authorship, whether in Source or <a href="Object.html"><code>Object</code></a> form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).</p>
|
113
|
+
|
114
|
+
<p>“Derivative Works” shall mean any work, whether in Source or <a href="Object.html"><code>Object</code></a> form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.</p>
|
115
|
+
|
116
|
+
<p>“Contribution” shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, “submitted” means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as “Not a Contribution.”</p>
|
117
|
+
|
118
|
+
<p>“Contributor” shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.</p>
|
146
119
|
</li><li>
|
147
|
-
<p>Grant of Copyright License. Subject to the terms and conditions of this
|
148
|
-
License, each Contributor hereby grants to You a perpetual, worldwide,
|
149
|
-
non-exclusive, no-charge, royalty-free, irrevocable copyright license to
|
150
|
-
reproduce, prepare Derivative Works of, publicly display, publicly perform,
|
151
|
-
sublicense, and distribute the Work and such Derivative Works in Source or
|
152
|
-
<a href="Object.html">Object</a> form.</p>
|
120
|
+
<p>Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or <a href="Object.html"><code>Object</code></a> form.</p>
|
153
121
|
</li><li>
|
154
|
-
<p>Grant of Patent License. Subject to the terms and conditions of this
|
155
|
-
License, each Contributor hereby grants to You a perpetual, worldwide,
|
156
|
-
non-exclusive, no-charge, royalty-free, irrevocable (except as stated in
|
157
|
-
this section) patent license to make, have made, use, offer to sell, sell,
|
158
|
-
import, and otherwise transfer the Work, where such license applies only to
|
159
|
-
those patent claims licensable by such Contributor that are necessarily
|
160
|
-
infringed by their Contribution(s) alone or by combination of their
|
161
|
-
Contribution(s) with the Work to which such Contribution(s) was submitted.
|
162
|
-
If You institute patent litigation against any entity (including a
|
163
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
164
|
-
Contribution incorporated within the Work constitutes direct or
|
165
|
-
contributory patent infringement, then any patent licenses granted to You
|
166
|
-
under this License for that Work shall terminate as of the date such
|
167
|
-
litigation is filed.</p>
|
122
|
+
<p>Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.</p>
|
168
123
|
</li><li>
|
169
|
-
<p>Redistribution. You may reproduce and distribute copies of the Work or
|
170
|
-
Derivative Works thereof in any medium, with or without modifications, and
|
171
|
-
in Source or <a href="Object.html">Object</a> form, provided that You meet
|
172
|
-
the following conditions:</p>
|
124
|
+
<p>Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or <a href="Object.html"><code>Object</code></a> form, provided that You meet the following conditions:</p>
|
173
125
|
|
174
126
|
<p>(a) You must give any other recipients of the Work or</p>
|
175
127
|
|
@@ -204,55 +156,17 @@ or as an addendum to the NOTICE text from the Work, provided
|
|
204
156
|
that such additional attribution notices cannot be construed
|
205
157
|
as modifying the License.</pre>
|
206
158
|
|
207
|
-
<p>You may add Your own copyright statement to Your modifications and may
|
208
|
-
provide additional or different license terms and conditions for use,
|
209
|
-
reproduction, or distribution of Your modifications, or for any such
|
210
|
-
Derivative Works as a whole, provided Your use, reproduction, and
|
211
|
-
distribution of the Work otherwise complies with the conditions stated in
|
212
|
-
this License.</p>
|
159
|
+
<p>You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.</p>
|
213
160
|
</li><li>
|
214
|
-
<p>Submission of Contributions. Unless You explicitly state otherwise, any
|
215
|
-
Contribution intentionally submitted for inclusion in the Work by You to
|
216
|
-
the Licensor shall be under the terms and conditions of this License,
|
217
|
-
without any additional terms or conditions. Notwithstanding the above,
|
218
|
-
nothing herein shall supersede or modify the terms of any separate license
|
219
|
-
agreement you may have executed with Licensor regarding such Contributions.</p>
|
161
|
+
<p>Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.</p>
|
220
162
|
</li><li>
|
221
|
-
<p>Trademarks. This License does not grant permission to use the trade names,
|
222
|
-
trademarks, service marks, or product names of the Licensor, except as
|
223
|
-
required for reasonable and customary use in describing the origin of the
|
224
|
-
Work and reproducing the content of the NOTICE file.</p>
|
163
|
+
<p>Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.</p>
|
225
164
|
</li><li>
|
226
|
-
<p>Disclaimer of Warranty. Unless required by applicable law or agreed to in
|
227
|
-
writing, Licensor provides the Work (and each Contributor provides its
|
228
|
-
Contributions) on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
229
|
-
KIND, either express or implied, including, without limitation, any
|
230
|
-
warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or
|
231
|
-
FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for
|
232
|
-
determining the appropriateness of using or redistributing the Work and
|
233
|
-
assume any risks associated with Your exercise of permissions under this
|
234
|
-
License.</p>
|
165
|
+
<p>Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.</p>
|
235
166
|
</li><li>
|
236
|
-
<p>Limitation of Liability. In no event and under no legal theory, whether in
|
237
|
-
tort (including negligence), contract, or otherwise, unless required by
|
238
|
-
applicable law (such as deliberate and grossly negligent acts) or agreed to
|
239
|
-
in writing, shall any Contributor be liable to You for damages, including
|
240
|
-
any direct, indirect, special, incidental, or consequential damages of any
|
241
|
-
character arising as a result of this License or out of the use or
|
242
|
-
inability to use the Work (including but not limited to damages for loss of
|
243
|
-
goodwill, work stoppage, computer failure or malfunction, or any and all
|
244
|
-
other commercial damages or losses), even if such Contributor has been
|
245
|
-
advised of the possibility of such damages.</p>
|
167
|
+
<p>Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.</p>
|
246
168
|
</li><li>
|
247
|
-
<p>Accepting Warranty or Additional Liability. While redistributing the Work
|
248
|
-
or Derivative Works thereof, You may choose to offer, and charge a fee for,
|
249
|
-
acceptance of support, warranty, indemnity, or other liability obligations
|
250
|
-
and/or rights consistent with this License. However, in accepting such
|
251
|
-
obligations, You may act only on Your own behalf and on Your sole
|
252
|
-
responsibility, not on behalf of any other Contributor, and only if You
|
253
|
-
agree to indemnify, defend, and hold each Contributor harmless for any
|
254
|
-
liability incurred by, or claims asserted against, such Contributor by
|
255
|
-
reason of your accepting any such warranty or additional liability.</p>
|
169
|
+
<p>Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.</p>
|
256
170
|
</li></ol>
|
257
171
|
|
258
172
|
<p>END OF TERMS AND CONDITIONS</p>
|
@@ -270,25 +184,20 @@ identification within third-party archives.</pre>
|
|
270
184
|
|
271
185
|
<p>Copyright 2020 StrongDM Inc</p>
|
272
186
|
|
273
|
-
<p>Licensed under the Apache License, Version 2.0 (the “License”); you may not
|
274
|
-
use this file except in compliance with the License. You may obtain a copy
|
275
|
-
of the License at</p>
|
187
|
+
<p>Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at</p>
|
276
188
|
|
277
|
-
<pre class="ruby"><span class="ruby-identifier">http</span
|
189
|
+
<pre class="ruby"><span class="ruby-identifier">http</span><span class="ruby-value">:/</span><span class="ruby-operator">/</span><span class="ruby-identifier">www</span>.<span class="ruby-identifier">apache</span>.<span class="ruby-identifier">org</span><span class="ruby-operator">/</span><span class="ruby-identifier">licenses</span><span class="ruby-operator">/</span><span class="ruby-constant">LICENSE</span><span class="ruby-value">-2.0</span>
|
278
190
|
</pre>
|
279
191
|
|
280
|
-
<p>Unless required by applicable law or agreed to in writing, software
|
281
|
-
|
282
|
-
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
283
|
-
License for the specific language governing permissions and limitations
|
284
|
-
under the License.</p>
|
192
|
+
<p>Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.</p>
|
193
|
+
|
285
194
|
</main>
|
286
195
|
|
287
196
|
|
288
197
|
|
289
198
|
<footer id="validator-badges" role="contentinfo">
|
290
|
-
<p><a href="
|
291
|
-
<p>Generated by <a href="
|
199
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
200
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.2.
|
292
201
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
293
202
|
</footer>
|
294
203
|
|
data/doc/Object.html
CHANGED
@@ -8,16 +8,21 @@
|
|
8
8
|
|
9
9
|
<script type="text/javascript">
|
10
10
|
var rdoc_rel_prefix = "./";
|
11
|
+
var index_rel_prefix = "./";
|
11
12
|
</script>
|
12
13
|
|
13
|
-
<script src="./js/
|
14
|
-
<script src="./js/
|
14
|
+
<script src="./js/navigation.js" defer></script>
|
15
|
+
<script src="./js/search.js" defer></script>
|
16
|
+
<script src="./js/search_index.js" defer></script>
|
17
|
+
<script src="./js/searcher.js" defer></script>
|
18
|
+
<script src="./js/darkfish.js" defer></script>
|
15
19
|
|
16
20
|
<link href="./css/fonts.css" rel="stylesheet">
|
17
21
|
<link href="./css/rdoc.css" rel="stylesheet">
|
18
22
|
|
19
23
|
|
20
24
|
|
25
|
+
|
21
26
|
<body id="top" role="document" class="class">
|
22
27
|
<nav role="navigation">
|
23
28
|
<div id="project-navigation">
|
@@ -72,6 +77,8 @@
|
|
72
77
|
|
73
78
|
<li ><a href="#method-i-main">#main</a>
|
74
79
|
|
80
|
+
<li ><a href="#method-i-okta_sync">#okta_sync</a>
|
81
|
+
|
75
82
|
</ul>
|
76
83
|
</div>
|
77
84
|
|
@@ -88,8 +95,6 @@
|
|
88
95
|
</section>
|
89
96
|
|
90
97
|
|
91
|
-
|
92
|
-
|
93
98
|
<section id="5Buntitled-5D" class="documentation-section">
|
94
99
|
|
95
100
|
|
@@ -117,6 +122,26 @@
|
|
117
122
|
<dd>
|
118
123
|
|
119
124
|
|
125
|
+
<dt id="OKTA_CLIENT_ORGURL">OKTA_CLIENT_ORGURL
|
126
|
+
|
127
|
+
<dd>
|
128
|
+
|
129
|
+
|
130
|
+
<dt id="OKTA_CLIENT_TOKEN">OKTA_CLIENT_TOKEN
|
131
|
+
|
132
|
+
<dd>
|
133
|
+
|
134
|
+
|
135
|
+
<dt id="SDM_API_ACCESS_KEY">SDM_API_ACCESS_KEY
|
136
|
+
|
137
|
+
<dd>
|
138
|
+
|
139
|
+
|
140
|
+
<dt id="SDM_API_SECRET_KEY">SDM_API_SECRET_KEY
|
141
|
+
|
142
|
+
<dd>
|
143
|
+
|
144
|
+
|
120
145
|
</dl>
|
121
146
|
</section>
|
122
147
|
|
@@ -143,128 +168,297 @@
|
|
143
168
|
|
144
169
|
<div class="method-description">
|
145
170
|
|
146
|
-
<p>panicButton.rb suspends all users except for one admin, in the fake use
|
147
|
-
case of a critical break in or something usage: ruby panicButton.rb
|
148
|
-
adminuser@email.com to revert back to pre-panic state: ruby panicButton.rb
|
149
|
-
revert</p>
|
171
|
+
<p>panicButton.rb suspends all users except for one admin, in the fake use case of a critical break in or something usage: ruby panicButton.rb adminuser@email.com to revert back to pre-panic state: ruby panicButton.rb revert</p>
|
150
172
|
|
151
173
|
|
152
174
|
|
153
175
|
|
154
176
|
<div class="method-source-code" id="main-source">
|
155
|
-
<pre><span class="ruby-comment"># File examples/panicButton.rb, line
|
156
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">main</span>
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
177
|
+
<pre><span class="ruby-comment"># File examples/panicButton.rb, line 25</span>
|
178
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">main</span>
|
179
|
+
<span class="ruby-identifier">access_key</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-string">"SDM_API_ACCESS_KEY"</span>]
|
180
|
+
<span class="ruby-identifier">secret_key</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-string">"SDM_API_SECRET_KEY"</span>]
|
181
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">access_key</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">secret_key</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span>
|
182
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"SDM_API_ACCESS_KEY and SDM_API_SECRET_KEY must be provided"</span>
|
183
|
+
<span class="ruby-keyword">return</span>
|
184
|
+
<span class="ruby-keyword">end</span>
|
185
|
+
<span class="ruby-identifier">client</span> = <span class="ruby-constant">SDM</span><span class="ruby-operator">::</span><span class="ruby-constant">Client</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">access_key</span>, <span class="ruby-identifier">secret_key</span>)
|
186
|
+
|
187
|
+
<span class="ruby-keyword">if</span> <span class="ruby-constant">ARGV</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-keyword">and</span> <span class="ruby-constant">ARGV</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-string">"revert"</span>
|
188
|
+
<span class="ruby-identifier">state_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-string">"state.json"</span>)
|
189
|
+
<span class="ruby-identifier">state</span> = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">state_file</span>)
|
190
|
+
|
191
|
+
<span class="ruby-identifier">reinstated_count</span> = <span class="ruby-value">0</span>
|
192
|
+
|
193
|
+
<span class="ruby-identifier">users</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">accounts</span>.<span class="ruby-identifier">list</span>(<span class="ruby-string">""</span>)
|
194
|
+
<span class="ruby-identifier">users</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">user</span><span class="ruby-operator">|</span>
|
195
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">suspended</span>
|
196
|
+
<span class="ruby-identifier">reinstated_count</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
197
|
+
<span class="ruby-identifier">user</span>.<span class="ruby-identifier">suspended</span> = <span class="ruby-keyword">false</span>
|
198
|
+
<span class="ruby-identifier">client</span>.<span class="ruby-identifier">accounts</span>.<span class="ruby-identifier">update</span>(<span class="ruby-identifier">user</span>)
|
199
|
+
<span class="ruby-keyword">end</span>
|
200
|
+
}
|
201
|
+
<span class="ruby-identifier">state</span>[<span class="ruby-string">"attachments"</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">attachment</span><span class="ruby-operator">|</span>
|
202
|
+
<span class="ruby-keyword">begin</span>
|
203
|
+
<span class="ruby-identifier">a</span> = <span class="ruby-constant">SDM</span><span class="ruby-operator">::</span><span class="ruby-constant">AccountAttachment</span>.<span class="ruby-identifier">new</span>()
|
204
|
+
<span class="ruby-identifier">a</span>.<span class="ruby-identifier">account_id</span> = <span class="ruby-identifier">attachment</span>[<span class="ruby-string">"account_id"</span>]
|
205
|
+
<span class="ruby-identifier">a</span>.<span class="ruby-identifier">role_id</span> = <span class="ruby-identifier">attachment</span>[<span class="ruby-string">"role_id"</span>]
|
206
|
+
<span class="ruby-identifier">client</span>.<span class="ruby-identifier">account_attachments</span>.<span class="ruby-identifier">create</span>(<span class="ruby-identifier">a</span>)
|
207
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">SDM</span><span class="ruby-operator">::</span><span class="ruby-constant">AlreadyExistsError</span>
|
208
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-operator">=></span> <span class="ruby-identifier">ex</span>
|
209
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"skipping creation of attachment due to error: "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">ex</span>.<span class="ruby-identifier">to_s</span>
|
210
|
+
<span class="ruby-keyword">end</span>
|
211
|
+
}
|
212
|
+
<span class="ruby-identifier">state</span>[<span class="ruby-string">"grants"</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">attachment</span><span class="ruby-operator">|</span>
|
213
|
+
<span class="ruby-keyword">begin</span>
|
214
|
+
<span class="ruby-identifier">g</span> = <span class="ruby-constant">SDM</span><span class="ruby-operator">::</span><span class="ruby-constant">AccountGrant</span>.<span class="ruby-identifier">new</span>()
|
215
|
+
<span class="ruby-identifier">g</span>.<span class="ruby-identifier">account_id</span> = <span class="ruby-identifier">attachment</span>[<span class="ruby-string">"account_id"</span>]
|
216
|
+
<span class="ruby-identifier">g</span>.<span class="ruby-identifier">resource_id</span> = <span class="ruby-identifier">attachment</span>[<span class="ruby-string">"resource_id"</span>]
|
217
|
+
<span class="ruby-identifier">client</span>.<span class="ruby-identifier">account_grants</span>.<span class="ruby-identifier">create</span>(<span class="ruby-identifier">g</span>)
|
218
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">SDM</span><span class="ruby-operator">::</span><span class="ruby-constant">AlreadyExistsError</span>
|
219
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-operator">=></span> <span class="ruby-identifier">ex</span>
|
220
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"skipping creation of grant due to error: "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">ex</span>.<span class="ruby-identifier">to_s</span>
|
221
|
+
<span class="ruby-keyword">end</span>
|
222
|
+
}
|
170
223
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
224
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"reinstated "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">reinstated_count</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">" users"</span>
|
225
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"recreated "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">state</span>[<span class="ruby-string">"attachments"</span>].<span class="ruby-identifier">size</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">" account attachments"</span>
|
226
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"recreated "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">state</span>[<span class="ruby-string">"grants"</span>].<span class="ruby-identifier">size</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">" account grants"</span>
|
227
|
+
|
228
|
+
<span class="ruby-keyword">return</span>
|
229
|
+
<span class="ruby-keyword">end</span>
|
230
|
+
|
231
|
+
<span class="ruby-identifier">admin_email</span> = <span class="ruby-string">""</span>
|
232
|
+
<span class="ruby-keyword">if</span> <span class="ruby-constant">ARGV</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
|
233
|
+
<span class="ruby-identifier">admin_email</span> = <span class="ruby-constant">ARGV</span>[<span class="ruby-value">0</span>]
|
234
|
+
<span class="ruby-keyword">else</span>
|
235
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"please provide an admin email to preserve"</span>
|
236
|
+
<span class="ruby-keyword">return</span> <span class="ruby-value">1</span>
|
237
|
+
<span class="ruby-keyword">end</span>
|
238
|
+
|
239
|
+
<span class="ruby-identifier">admin_user_id</span> = <span class="ruby-string">""</span>
|
240
|
+
<span class="ruby-identifier">users</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">accounts</span>.<span class="ruby-identifier">list</span>(<span class="ruby-string">"email:?"</span>, <span class="ruby-identifier">admin_email</span>)
|
241
|
+
<span class="ruby-identifier">users</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">user</span><span class="ruby-operator">|</span>
|
242
|
+
<span class="ruby-identifier">admin_user_id</span> = <span class="ruby-identifier">user</span>.<span class="ruby-identifier">id</span>
|
243
|
+
}
|
244
|
+
|
245
|
+
<span class="ruby-identifier">account_attachments</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">account_attachments</span>.<span class="ruby-identifier">list</span>(<span class="ruby-string">""</span>)
|
246
|
+
<span class="ruby-identifier">account_grants</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">account_grants</span>.<span class="ruby-identifier">list</span>(<span class="ruby-string">""</span>)
|
247
|
+
|
248
|
+
<span class="ruby-identifier">state</span> = {
|
249
|
+
<span class="ruby-value">'attachments':</span> <span class="ruby-identifier">account_attachments</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span>
|
250
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">account_id</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">admin_user_id</span>
|
251
|
+
<span class="ruby-identifier">out</span> = {
|
252
|
+
<span class="ruby-value">'account_id':</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">account_id</span>,
|
253
|
+
<span class="ruby-value">'role_id':</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">role_id</span>,
|
189
254
|
}
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
<span class="ruby-keyword">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">ex</span>
|
198
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-string">"skipping creation of grant due to error: "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">ex</span>.<span class="ruby-identifier">to_s</span>
|
199
|
-
<span class="ruby-keyword">end</span>
|
255
|
+
<span class="ruby-keyword">end</span>
|
256
|
+
}.<span class="ruby-identifier">reject</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span> },
|
257
|
+
<span class="ruby-value">'grants':</span> <span class="ruby-identifier">account_grants</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span>
|
258
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">account_id</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">admin_user_id</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">valid_until</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span>
|
259
|
+
<span class="ruby-identifier">out</span> = {
|
260
|
+
<span class="ruby-value">'account_id':</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">account_id</span>,
|
261
|
+
<span class="ruby-value">'resource_id':</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">resource_id</span>,
|
200
262
|
}
|
263
|
+
<span class="ruby-keyword">end</span>
|
264
|
+
}.<span class="ruby-identifier">reject</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span> },
|
265
|
+
}
|
201
266
|
|
202
|
-
|
203
|
-
|
204
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-string">"recreated "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">state</span>[<span class="ruby-string">"grants"</span>].<span class="ruby-identifier">size</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">" account grants"</span>
|
267
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"storing "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">state</span>[<span class="ruby-value">:attachments</span>].<span class="ruby-identifier">size</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">" account attachments in state"</span>
|
268
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"storing "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">state</span>[<span class="ruby-value">:grants</span>].<span class="ruby-identifier">size</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">" account grants in state"</span>
|
205
269
|
|
206
|
-
|
207
|
-
|
270
|
+
<span class="ruby-identifier">state_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-string">"state.json"</span>, <span class="ruby-string">"w"</span>)
|
271
|
+
<span class="ruby-identifier">state_file</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">state</span>.<span class="ruby-identifier">to_json</span>)
|
208
272
|
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
<span class="ruby-keyword">
|
213
|
-
|
214
|
-
<span class="ruby-keyword">return</span> <span class="ruby-value">1</span>
|
273
|
+
<span class="ruby-identifier">suspended_count</span> = <span class="ruby-value">0</span>
|
274
|
+
<span class="ruby-identifier">users</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">accounts</span>.<span class="ruby-identifier">list</span>(<span class="ruby-string">""</span>)
|
275
|
+
<span class="ruby-identifier">users</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">user</span><span class="ruby-operator">|</span>
|
276
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">instance_of?</span> <span class="ruby-constant">SDM</span><span class="ruby-operator">::</span><span class="ruby-constant">User</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">email</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">admin_email</span>
|
277
|
+
<span class="ruby-keyword">next</span>
|
215
278
|
<span class="ruby-keyword">end</span>
|
279
|
+
<span class="ruby-identifier">user</span>.<span class="ruby-identifier">suspended</span> = <span class="ruby-keyword">true</span>
|
280
|
+
<span class="ruby-keyword">begin</span>
|
281
|
+
<span class="ruby-identifier">client</span>.<span class="ruby-identifier">accounts</span>.<span class="ruby-identifier">update</span>(<span class="ruby-identifier">user</span>)
|
282
|
+
<span class="ruby-identifier">suspended_count</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
283
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> <span class="ruby-operator">=></span> <span class="ruby-identifier">ex</span>
|
284
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"skipping user "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">id</span> <span class="ruby-operator">+</span> <span class="ruby-string">" on account of error: "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">ex</span>.<span class="ruby-identifier">to_s</span>
|
285
|
+
<span class="ruby-keyword">end</span>
|
286
|
+
}
|
216
287
|
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
288
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"suspended "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">suspended_count</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">" users"</span>
|
289
|
+
<span class="ruby-keyword">end</span></pre>
|
290
|
+
</div>
|
291
|
+
|
292
|
+
</div>
|
222
293
|
|
223
|
-
|
224
|
-
<span class="ruby-identifier">account_grants</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">account_grants</span>.<span class="ruby-identifier">list</span>(<span class="ruby-string">''</span>)
|
294
|
+
|
225
295
|
|
226
|
-
|
227
|
-
|
228
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">account_id</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">admin_user_id</span>
|
229
|
-
<span class="ruby-identifier">out</span> = {
|
230
|
-
<span class="ruby-string">'account_id'</span><span class="ruby-operator">:</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">account_id</span>,
|
231
|
-
<span class="ruby-string">'role_id'</span><span class="ruby-operator">:</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">role_id</span>,
|
232
|
-
}
|
233
|
-
<span class="ruby-keyword">end</span>
|
234
|
-
}.<span class="ruby-identifier">reject</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span>},
|
235
|
-
<span class="ruby-string">'grants'</span><span class="ruby-operator">:</span> <span class="ruby-identifier">account_grants</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span>
|
236
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">account_id</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">admin_user_id</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">valid_until</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span>
|
237
|
-
<span class="ruby-identifier">out</span> = {
|
238
|
-
<span class="ruby-string">'account_id'</span><span class="ruby-operator">:</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">account_id</span>,
|
239
|
-
<span class="ruby-string">'resource_id'</span><span class="ruby-operator">:</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">resource_id</span>,
|
240
|
-
}
|
241
|
-
<span class="ruby-keyword">end</span>
|
242
|
-
}.<span class="ruby-identifier">reject</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span>},
|
243
|
-
}
|
296
|
+
|
297
|
+
</div>
|
244
298
|
|
245
|
-
|
246
|
-
|
299
|
+
|
300
|
+
<div id="method-i-okta_sync" class="method-detail ">
|
301
|
+
|
302
|
+
<div class="method-heading">
|
303
|
+
<span class="method-name">okta_sync</span><span
|
304
|
+
class="method-args">()</span>
|
305
|
+
|
306
|
+
<span class="method-click-advice">click to toggle source</span>
|
307
|
+
|
308
|
+
</div>
|
309
|
+
|
247
310
|
|
248
|
-
|
249
|
-
|
311
|
+
<div class="method-description">
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
250
316
|
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
317
|
+
|
318
|
+
<div class="method-source-code" id="okta_sync-source">
|
319
|
+
<pre><span class="ruby-comment"># File examples/okta-sync/oktaSync.rb, line 25</span>
|
320
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">okta_sync</span>
|
321
|
+
<span class="ruby-keyword">if</span> <span class="ruby-constant">SDM_API_ACCESS_KEY</span> <span class="ruby-operator">==</span> <span class="ruby-string">""</span> <span class="ruby-operator">||</span> <span class="ruby-constant">SDM_API_SECRET_KEY</span> <span class="ruby-operator">==</span> <span class="ruby-string">""</span> <span class="ruby-operator">||</span> <span class="ruby-constant">OKTA_CLIENT_TOKEN</span> <span class="ruby-operator">==</span> <span class="ruby-string">""</span> <span class="ruby-operator">||</span> <span class="ruby-constant">OKTA_CLIENT_ORGURL</span> <span class="ruby-operator">==</span> <span class="ruby-string">""</span>
|
322
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"SDM_API_ACCESS_KEY, SDM_API_SECRET_KEY, OKTA_CLIENT_TOKEN, and OKTA_CLIENT_ORGURL must be set"</span>
|
323
|
+
<span class="ruby-identifier">exit</span>
|
324
|
+
<span class="ruby-keyword">end</span>
|
325
|
+
|
326
|
+
<span class="ruby-identifier">report</span> = {
|
327
|
+
<span class="ruby-value">:start</span> <span class="ruby-operator">=></span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>,
|
328
|
+
|
329
|
+
<span class="ruby-value">:oktaUsersCount</span> <span class="ruby-operator">=></span> <span class="ruby-value">0</span>,
|
330
|
+
<span class="ruby-value">:oktaUsers</span> <span class="ruby-operator">=></span> [],
|
331
|
+
|
332
|
+
<span class="ruby-value">:sdmUsersCount</span> <span class="ruby-operator">=></span> <span class="ruby-value">0</span>,
|
333
|
+
<span class="ruby-value">:sdmUsers</span> <span class="ruby-operator">=></span> [],
|
334
|
+
|
335
|
+
<span class="ruby-value">:bothUsersCount</span> <span class="ruby-operator">=></span> <span class="ruby-value">0</span>,
|
336
|
+
|
337
|
+
<span class="ruby-value">:sdmResourcesCount</span> <span class="ruby-operator">=></span> <span class="ruby-value">0</span>,
|
338
|
+
<span class="ruby-value">:sdmResources</span> <span class="ruby-operator">=></span> {},
|
339
|
+
|
340
|
+
<span class="ruby-value">:permissionsGranted</span> <span class="ruby-operator">=></span> <span class="ruby-value">0</span>,
|
341
|
+
<span class="ruby-value">:permissionsRevoked</span> <span class="ruby-operator">=></span> <span class="ruby-value">0</span>,
|
342
|
+
<span class="ruby-value">:grants</span> <span class="ruby-operator">=></span> [],
|
343
|
+
<span class="ruby-value">:revocations</span> <span class="ruby-operator">=></span> [],
|
344
|
+
|
345
|
+
<span class="ruby-value">:matchers</span> <span class="ruby-operator">=></span> {},
|
346
|
+
}
|
347
|
+
|
348
|
+
<span class="ruby-identifier">plan</span> = <span class="ruby-keyword">false</span>
|
349
|
+
<span class="ruby-identifier">verbose</span> = <span class="ruby-keyword">false</span>
|
350
|
+
<span class="ruby-constant">OptionParser</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">opts</span><span class="ruby-operator">|</span>
|
351
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">banner</span> = <span class="ruby-string">"Usage oktaSync.rb [options]"</span>
|
352
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">"-p"</span>, <span class="ruby-string">"--plan"</span>, <span class="ruby-string">"calculate changes but do not apply them"</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
|
353
|
+
<span class="ruby-identifier">plan</span> = <span class="ruby-identifier">p</span>
|
354
|
+
<span class="ruby-keyword">end</span>
|
355
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-string">"-v"</span>, <span class="ruby-string">"--verbose"</span>, <span class="ruby-string">"print detailed report"</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
356
|
+
<span class="ruby-identifier">verbose</span> = <span class="ruby-identifier">v</span>
|
357
|
+
<span class="ruby-keyword">end</span>
|
358
|
+
<span class="ruby-keyword">end</span>.<span class="ruby-identifier">parse!</span>
|
359
|
+
|
360
|
+
<span class="ruby-identifier">client</span> = <span class="ruby-constant">SDM</span><span class="ruby-operator">::</span><span class="ruby-constant">Client</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">SDM_API_ACCESS_KEY</span>, <span class="ruby-constant">SDM_API_SECRET_KEY</span>)
|
361
|
+
<span class="ruby-identifier">okta_client</span> = <span class="ruby-constant">Oktakit</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">token:</span> <span class="ruby-constant">OKTA_CLIENT_TOKEN</span>, <span class="ruby-value">api_endpoint:</span> <span class="ruby-constant">OKTA_CLIENT_ORGURL</span> <span class="ruby-operator">+</span> <span class="ruby-string">"/api/v1"</span>)
|
362
|
+
<span class="ruby-identifier">matchers</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-string">"matchers.yml"</span>))
|
363
|
+
<span class="ruby-identifier">report</span>[<span class="ruby-value">:matchers</span>] = <span class="ruby-identifier">matchers</span>
|
364
|
+
|
365
|
+
<span class="ruby-identifier">all_users</span> = <span class="ruby-identifier">okta_client</span>.<span class="ruby-identifier">list_users</span>({
|
366
|
+
<span class="ruby-value">'query':</span> {
|
367
|
+
<span class="ruby-value">'search':</span> <span class="ruby-string">"profile.department eq \"Engineering\" and (status eq \"ACTIVE\")"</span>,
|
368
|
+
},
|
369
|
+
})
|
370
|
+
|
371
|
+
<span class="ruby-identifier">okta_users</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>()
|
372
|
+
<span class="ruby-identifier">all_users</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">u</span><span class="ruby-operator">|</span>
|
373
|
+
<span class="ruby-identifier">groups</span> = <span class="ruby-identifier">okta_client</span>.<span class="ruby-identifier">get_member_groups</span>(<span class="ruby-identifier">u</span>.<span class="ruby-identifier">id</span>)
|
374
|
+
<span class="ruby-identifier">group_names</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>()
|
375
|
+
<span class="ruby-identifier">groups</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">ug</span><span class="ruby-operator">|</span>
|
376
|
+
<span class="ruby-identifier">group_names</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ug</span>.<span class="ruby-identifier">profile</span>.<span class="ruby-identifier">name</span>)
|
377
|
+
}
|
378
|
+
<span class="ruby-identifier">okta_users</span>.<span class="ruby-identifier">push</span>({ <span class="ruby-value">:login</span> <span class="ruby-operator">=></span> <span class="ruby-identifier">u</span>.<span class="ruby-identifier">profile</span>.<span class="ruby-identifier">login</span>, <span class="ruby-value">:first_name</span> <span class="ruby-operator">=></span> <span class="ruby-identifier">u</span>.<span class="ruby-identifier">profile</span>.<span class="ruby-identifier">firstName</span>, <span class="ruby-value">:last_name</span> <span class="ruby-operator">=></span> <span class="ruby-identifier">u</span>.<span class="ruby-identifier">profile</span>.<span class="ruby-constant">LastName</span>, <span class="ruby-value">:groups</span> <span class="ruby-operator">=></span> <span class="ruby-identifier">group_names</span> })
|
379
|
+
}
|
380
|
+
<span class="ruby-identifier">report</span>[<span class="ruby-value">:oktaUsers</span>] = <span class="ruby-identifier">okta_users</span>
|
381
|
+
<span class="ruby-identifier">report</span>[<span class="ruby-value">:oktaUsersCount</span>] = <span class="ruby-identifier">okta_users</span>.<span class="ruby-identifier">size</span>
|
382
|
+
|
383
|
+
<span class="ruby-identifier">accounts</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">accounts</span>.<span class="ruby-identifier">list</span>(<span class="ruby-string">"type:user"</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> [<span class="ruby-identifier">a</span>.<span class="ruby-identifier">email</span>, <span class="ruby-identifier">a</span>] }.<span class="ruby-identifier">to_h</span>
|
384
|
+
<span class="ruby-identifier">report</span>[<span class="ruby-value">:sdmUsers</span>] = <span class="ruby-identifier">accounts</span>
|
385
|
+
<span class="ruby-identifier">report</span>[<span class="ruby-value">:sdmUsersCount</span>] = <span class="ruby-identifier">accounts</span>.<span class="ruby-identifier">size</span>
|
386
|
+
<span class="ruby-identifier">grants</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">account_grants</span>.<span class="ruby-identifier">list</span>(<span class="ruby-string">""</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">ag</span><span class="ruby-operator">|</span> <span class="ruby-identifier">ag</span> }
|
387
|
+
|
388
|
+
<span class="ruby-identifier">current</span> = {}
|
389
|
+
<span class="ruby-identifier">grants</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span>
|
390
|
+
<span class="ruby-identifier">current</span>[<span class="ruby-identifier">g</span>.<span class="ruby-identifier">account_id</span>] = [] <span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span> <span class="ruby-identifier">current</span>[<span class="ruby-identifier">g</span>.<span class="ruby-identifier">account_id</span>]
|
391
|
+
<span class="ruby-identifier">current</span>[<span class="ruby-identifier">g</span>.<span class="ruby-identifier">account_id</span>].<span class="ruby-identifier">push</span>({ <span class="ruby-value">:resource_id</span> <span class="ruby-operator">=></span> <span class="ruby-identifier">g</span>.<span class="ruby-identifier">resource_id</span>, <span class="ruby-value">:id</span> <span class="ruby-operator">=></span> <span class="ruby-identifier">g</span>.<span class="ruby-identifier">id</span> })
|
392
|
+
}
|
393
|
+
|
394
|
+
<span class="ruby-identifier">desired</span> = {}
|
395
|
+
<span class="ruby-identifier">overlapping</span> = <span class="ruby-value">0</span>
|
396
|
+
<span class="ruby-identifier">matchers</span>[<span class="ruby-string">"groups"</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">group</span><span class="ruby-operator">|</span>
|
397
|
+
<span class="ruby-identifier">group</span>[<span class="ruby-string">"resources"</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">resourceQuery</span><span class="ruby-operator">|</span>
|
398
|
+
<span class="ruby-identifier">client</span>.<span class="ruby-identifier">resources</span>.<span class="ruby-identifier">list</span>(<span class="ruby-identifier">resourceQuery</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">res</span><span class="ruby-operator">|</span>
|
399
|
+
<span class="ruby-identifier">report</span>[<span class="ruby-value">:sdmResources</span>][<span class="ruby-identifier">res</span>.<span class="ruby-identifier">id</span>] = <span class="ruby-identifier">res</span>
|
400
|
+
<span class="ruby-identifier">okta_users</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">u</span><span class="ruby-operator">|</span>
|
401
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">u</span>[<span class="ruby-value">:groups</span>].<span class="ruby-identifier">include?</span> <span class="ruby-identifier">group</span>[<span class="ruby-string">"name"</span>]
|
402
|
+
<span class="ruby-identifier">account</span> = <span class="ruby-identifier">accounts</span>[<span class="ruby-identifier">u</span>[<span class="ruby-value">:login</span>]]
|
403
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">account</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span>
|
404
|
+
<span class="ruby-identifier">overlapping</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
405
|
+
<span class="ruby-identifier">desired</span>[<span class="ruby-identifier">account</span>.<span class="ruby-identifier">id</span>] = [] <span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span> <span class="ruby-identifier">desired</span>[<span class="ruby-identifier">account</span>.<span class="ruby-identifier">id</span>]
|
406
|
+
<span class="ruby-identifier">desired</span>[<span class="ruby-identifier">account</span>.<span class="ruby-identifier">id</span>].<span class="ruby-identifier">push</span>(<span class="ruby-identifier">res</span>.<span class="ruby-identifier">id</span>)
|
407
|
+
<span class="ruby-keyword">end</span>
|
408
|
+
<span class="ruby-keyword">end</span>
|
409
|
+
}
|
410
|
+
}
|
411
|
+
}
|
412
|
+
}
|
413
|
+
<span class="ruby-identifier">report</span>[<span class="ruby-value">:bothUsersCount</span>] = <span class="ruby-identifier">overlapping</span>
|
414
|
+
<span class="ruby-identifier">report</span>[<span class="ruby-value">:sdmResourcesCount</span>] = <span class="ruby-identifier">report</span>[<span class="ruby-value">:sdmResources</span>].<span class="ruby-identifier">size</span>
|
415
|
+
|
416
|
+
<span class="ruby-identifier">revocations</span> = <span class="ruby-value">0</span>
|
417
|
+
<span class="ruby-identifier">current</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">aid</span>, <span class="ruby-identifier">curRes</span><span class="ruby-operator">|</span>
|
418
|
+
<span class="ruby-identifier">desRes</span> = <span class="ruby-identifier">desired</span>[<span class="ruby-identifier">aid</span>]
|
419
|
+
<span class="ruby-identifier">desRes</span> = [] <span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span> <span class="ruby-identifier">desired</span>[<span class="ruby-identifier">aid</span>]
|
420
|
+
<span class="ruby-identifier">curRes</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span>
|
421
|
+
<span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span>(<span class="ruby-identifier">desRes</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">r</span>[<span class="ruby-value">:resource_id</span>])
|
422
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">plan</span>
|
423
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"Plan: revoke %s from user %s\n"</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">r</span>[<span class="ruby-value">:resource_id</span>], <span class="ruby-identifier">aid</span>]
|
424
|
+
<span class="ruby-keyword">else</span>
|
425
|
+
<span class="ruby-identifier">client</span>.<span class="ruby-identifier">account_grants</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">r</span>[<span class="ruby-value">:id</span>])
|
256
426
|
<span class="ruby-keyword">end</span>
|
257
|
-
<span class="ruby-identifier">
|
258
|
-
<span class="ruby-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
427
|
+
<span class="ruby-identifier">report</span>[<span class="ruby-value">:revocations</span>].<span class="ruby-identifier">push</span>(<span class="ruby-identifier">r</span>[<span class="ruby-value">:id</span>])
|
428
|
+
<span class="ruby-identifier">revocations</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
429
|
+
<span class="ruby-keyword">end</span>
|
430
|
+
}
|
431
|
+
}
|
432
|
+
<span class="ruby-identifier">report</span>[<span class="ruby-value">:permissionsRevoked</span>] = <span class="ruby-identifier">revocations</span>
|
433
|
+
|
434
|
+
<span class="ruby-identifier">grants</span> = <span class="ruby-value">0</span>
|
435
|
+
<span class="ruby-identifier">desired</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">aid</span>, <span class="ruby-identifier">desRes</span><span class="ruby-operator">|</span>
|
436
|
+
<span class="ruby-identifier">curRes</span> = <span class="ruby-identifier">current</span>[<span class="ruby-identifier">aid</span>]
|
437
|
+
<span class="ruby-identifier">curRes</span> = [] <span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span> <span class="ruby-identifier">current</span>[<span class="ruby-identifier">aid</span>]
|
438
|
+
<span class="ruby-identifier">desRes</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span>
|
439
|
+
<span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span>(<span class="ruby-identifier">curRes</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>[<span class="ruby-value">:resource_id</span>] }.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">r</span>)
|
440
|
+
<span class="ruby-identifier">ag</span> = <span class="ruby-constant">SDM</span><span class="ruby-operator">::</span><span class="ruby-constant">AccountGrant</span>.<span class="ruby-identifier">new</span>()
|
441
|
+
<span class="ruby-identifier">ag</span>.<span class="ruby-identifier">account_id</span> = <span class="ruby-identifier">aid</span>
|
442
|
+
<span class="ruby-identifier">ag</span>.<span class="ruby-identifier">resource_id</span> = <span class="ruby-identifier">r</span>
|
443
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">plan</span>
|
444
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"Plan: grant %s to user %s\n"</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">r</span>, <span class="ruby-identifier">aid</span>]
|
445
|
+
<span class="ruby-keyword">else</span>
|
446
|
+
<span class="ruby-identifier">client</span>.<span class="ruby-identifier">account_grants</span>.<span class="ruby-identifier">create</span>(<span class="ruby-identifier">ag</span>)
|
263
447
|
<span class="ruby-keyword">end</span>
|
448
|
+
<span class="ruby-identifier">report</span>[<span class="ruby-value">:grants</span>].<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ag</span>)
|
449
|
+
<span class="ruby-identifier">grants</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
450
|
+
<span class="ruby-keyword">end</span>
|
264
451
|
}
|
452
|
+
}
|
453
|
+
<span class="ruby-identifier">report</span>[<span class="ruby-value">:permissionsGranted</span>] = <span class="ruby-identifier">grants</span>
|
265
454
|
|
266
|
-
|
455
|
+
<span class="ruby-identifier">report</span>[<span class="ruby-value">:complete</span>] = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
267
456
|
|
457
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">verbose</span>
|
458
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">report</span>.<span class="ruby-identifier">to_json</span>
|
459
|
+
<span class="ruby-keyword">else</span>
|
460
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"%d Okta users, %d strongDM users, %d overlapping users, %d grants, %d revocations"</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">okta_users</span>.<span class="ruby-identifier">size</span>, <span class="ruby-identifier">accounts</span>.<span class="ruby-identifier">size</span>, <span class="ruby-identifier">overlapping</span>, <span class="ruby-identifier">grants</span>, <span class="ruby-identifier">revocations</span>]
|
461
|
+
<span class="ruby-keyword">end</span>
|
268
462
|
<span class="ruby-keyword">end</span></pre>
|
269
463
|
</div>
|
270
464
|
|
@@ -279,12 +473,13 @@ revert</p>
|
|
279
473
|
</section>
|
280
474
|
|
281
475
|
</section>
|
476
|
+
|
282
477
|
</main>
|
283
478
|
|
284
479
|
|
285
480
|
<footer id="validator-badges" role="contentinfo">
|
286
|
-
<p><a href="
|
287
|
-
<p>Generated by <a href="
|
481
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
482
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.2.
|
288
483
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
289
484
|
</footer>
|
290
485
|
|