sp-seutils 0.0.1 → 0.0.2
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/lib/sp-seutils.rb +6 -11
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b00d6d780a49c095b8dd0be022c840570fdd84f3884a5fa30f07ffd98574f0e3
|
|
4
|
+
data.tar.gz: bbffb16003d9f93c8dde7ded798dab195757e46b5574e682fd16e6e5c1655590
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8a59afbfd523b0f95482eed68d944615497d5e3b0b1cb6cab0e3f3cd7f28d4a4290f12be1a3052a2a697a8a9b27ad275313b394bbb922bd0ad8ea380a76bebeb
|
|
7
|
+
data.tar.gz: 5d318e31a53927d7fae7bf64270db79b1771e4ccb2612ef31ac75e5b0c4a69ed33ffa4472202085c2a1bcab6d95cf85fe907953913c7f4fbe7f5e27cf2e15b23
|
data/lib/sp-seutils.rb
CHANGED
|
@@ -188,7 +188,6 @@ class SeUtils
|
|
|
188
188
|
i = 0
|
|
189
189
|
loop do
|
|
190
190
|
url = URI.join(org, api).to_s+arg.to_s+"?limit=250&offset="+i.to_s
|
|
191
|
-
# puts "executing API GET #{url}"
|
|
192
191
|
token = token || idn_oauth(org,user,password,client_id,client_secret)
|
|
193
192
|
page = nil
|
|
194
193
|
RestClient.get(url, {'Authorization' => "Bearer #{token}", 'X-CSRF-Token' => 'nocheck' } ) do |response, request, result, &block|
|
|
@@ -536,7 +535,6 @@ class SeUtils
|
|
|
536
535
|
i += page.length
|
|
537
536
|
page.each do |u|
|
|
538
537
|
users[u["name"].split(" ").join(".")] = u["externalId"] unless u.nil?
|
|
539
|
-
@idn_users << u unless u.nil?
|
|
540
538
|
nil_users+=1 if u.nil?
|
|
541
539
|
end
|
|
542
540
|
break if page.length != 250
|
|
@@ -571,7 +569,6 @@ class SeUtils
|
|
|
571
569
|
timeout: nil,
|
|
572
570
|
headers: {'Authorization' => "Bearer #{token}",
|
|
573
571
|
"Accept"=>"*/*" ,
|
|
574
|
-
'Cache-Control' => 'no-cache',
|
|
575
572
|
'Content-Type' => 'application/json',
|
|
576
573
|
'cache-control' => 'no-cache'
|
|
577
574
|
}
|
|
@@ -660,7 +657,6 @@ class SeUtils
|
|
|
660
657
|
timeout: nil,
|
|
661
658
|
headers: {'Authorization' => "Bearer #{token}",
|
|
662
659
|
"Accept"=>"*/*" ,
|
|
663
|
-
'Cache-Control' => 'no-cache',
|
|
664
660
|
'Content-Type' => 'application/json',
|
|
665
661
|
'cache-control' => 'no-cache'
|
|
666
662
|
}
|
|
@@ -1449,7 +1445,6 @@ class SeUtils
|
|
|
1449
1445
|
timeout: nil,
|
|
1450
1446
|
headers: {'Authorization' => "Bearer #{token}",
|
|
1451
1447
|
"Accept"=>"*/*" ,
|
|
1452
|
-
'Cache-Control' => 'no-cache',
|
|
1453
1448
|
'Content-Type' => 'application/json',
|
|
1454
1449
|
'cache-control' => 'no-cache'
|
|
1455
1450
|
}
|
|
@@ -1598,8 +1593,8 @@ class SeUtils
|
|
|
1598
1593
|
return result
|
|
1599
1594
|
end
|
|
1600
1595
|
|
|
1601
|
-
def self.source_name_id_extid(org,
|
|
1602
|
-
sources_list = JSON.parse(api_get(org,
|
|
1596
|
+
def self.source_name_id_extid(org,user,pass,client_id,client_secret,token)
|
|
1597
|
+
sources_list = JSON.parse(api_get(org,"source/list",user,pass,client_id,client_secret,token))
|
|
1603
1598
|
name_id_extid = {}
|
|
1604
1599
|
sources_list.each do |i|
|
|
1605
1600
|
next if i["name"] == "IdN Admins" # skip this source, which is flat file and unique to each IdN org
|
|
@@ -1611,7 +1606,7 @@ class SeUtils
|
|
|
1611
1606
|
return name_id_extid
|
|
1612
1607
|
end
|
|
1613
1608
|
|
|
1614
|
-
def self.entitlement_id_transform(org,
|
|
1609
|
+
def self.entitlement_id_transform(org,user,pass,client_id,client_secret,token)
|
|
1615
1610
|
entitlement_maps = {}
|
|
1616
1611
|
source_dir_contents = Dir.entries(@sources_dir)[2..-1]
|
|
1617
1612
|
sources = {}
|
|
@@ -1638,7 +1633,7 @@ class SeUtils
|
|
|
1638
1633
|
all_entitlement_map[ent["id"]][:name] = ent["displayableName"] if ent["displayName"].nil? # could be a bug?
|
|
1639
1634
|
end
|
|
1640
1635
|
end
|
|
1641
|
-
sources_list = JSON.parse(api_get(org,
|
|
1636
|
+
sources_list = JSON.parse(api_get(org,"source/list",user,pass,client_id,client_secret,token))
|
|
1642
1637
|
ext_ids = {}
|
|
1643
1638
|
sources_list.each do |i|
|
|
1644
1639
|
next if i["name"] == "IdN Admins" # skip this source, which is flat file and unique to each IdN org
|
|
@@ -1651,7 +1646,7 @@ class SeUtils
|
|
|
1651
1646
|
ext_ids.each do |id, ext_id|
|
|
1652
1647
|
threads << Thread.new do
|
|
1653
1648
|
app_entitlements = []
|
|
1654
|
-
result = api_get(org, "entitlement/list/?CISApplicationId=#{ext_id}",
|
|
1649
|
+
result = api_get(org, "entitlement/list/?CISApplicationId=#{ext_id}",user,pass,client_id,client_secret,token)
|
|
1655
1650
|
entitlement_bundle = JSON.parse(result)["items"]
|
|
1656
1651
|
entitlement_bundle.each do |ent|
|
|
1657
1652
|
entitlement = {}
|
|
@@ -2322,7 +2317,7 @@ class SeUtils
|
|
|
2322
2317
|
def self.rest_value_array(a)
|
|
2323
2318
|
return a if (a == []) || (a.nil?)
|
|
2324
2319
|
s = ["["]
|
|
2325
|
-
a.each{ |i| s << i+','}
|
|
2320
|
+
a.each{ |i| s << i.to_s+','}
|
|
2326
2321
|
s.last.chop!
|
|
2327
2322
|
s << "]"
|
|
2328
2323
|
a = s.join
|