casdoor-ruby-sdk 1.1.0 → 1.1.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/casdoor/ldap.rb +5 -5
- data/lib/casdoor/record.rb +7 -1
- data/lib/casdoor/transaction.rb +3 -1
- data/lib/casdoor/version.rb +1 -1
- 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: 9b4321645840f3099b3e3110a79eb81eae7cf082f5ffcf2165238f0ca172c6f9
|
|
4
|
+
data.tar.gz: 67ade61abfaf98aee3fc5cb8b2166e43696472f7b3d069b7eeb0993c68cef8e5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8869f76745de4b3afefaa7a6c557e5db89c236b6ef39108127bdd08d0d44479b10ac6b9acd55e48f4292ac27a98bc370cfc1f8c05676358cb00f17947aa05577
|
|
7
|
+
data.tar.gz: e304a2c98279903e241ffcd3d1ec9412400da08b6ebd909944aac3c12e0efc5b089e320c7b62b359c5e40b9758b51bd3a3f8ae4756d108be732fdc6128b8a45f
|
data/lib/casdoor/ldap.rb
CHANGED
|
@@ -28,23 +28,23 @@ module Casdoor
|
|
|
28
28
|
# The LDAP APIs, the counterpart of ldap.go of the Go SDK
|
|
29
29
|
class Client
|
|
30
30
|
def get_ldaps
|
|
31
|
-
get_objects('get-ldaps', Ldap, 'owner' =>
|
|
31
|
+
get_objects('get-ldaps', Ldap, 'owner' => organization_name)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def get_ldap(id)
|
|
35
|
-
get_object('get-ldap', Ldap, 'id' =>
|
|
35
|
+
get_object('get-ldap', Ldap, 'id' => get_id(id))
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
def add_ldap(ldap)
|
|
39
|
-
modify_object('add-ldap', Ldap, ldap,
|
|
39
|
+
modify_object('add-ldap', Ldap, ldap, organization_name)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def delete_ldap(ldap)
|
|
43
|
-
modify_object('delete-ldap', Ldap, ldap,
|
|
43
|
+
modify_object('delete-ldap', Ldap, ldap, organization_name)
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def update_ldap(ldap)
|
|
47
|
-
modify_object('update-ldap', Ldap, ldap,
|
|
47
|
+
modify_object('update-ldap', Ldap, ldap, organization_name)
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
# The users in the LDAP server. Returns a hash like {"users" => [LdapUser], "existUuids" => [...]}.
|
data/lib/casdoor/record.rb
CHANGED
|
@@ -29,8 +29,14 @@ module Casdoor
|
|
|
29
29
|
get_pagination_objects('get-records', Record, organization_name, page, page_size, query_map)
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
# Gets the record by name, or nil if it doesn't exist. Casdoor has no API to get a single record, so it searches
|
|
33
|
+
# the records by name. Like the other APIs that read records, it needs the access token of an admin user, see
|
|
34
|
+
# with_access_token().
|
|
32
35
|
def get_record(name)
|
|
33
|
-
|
|
36
|
+
name = name.to_s.split('/').last.to_s
|
|
37
|
+
# The name filter matches the records whose names contain the given name
|
|
38
|
+
records, = get_pagination_records(1, 100, 'field' => 'name', 'value' => name)
|
|
39
|
+
records.find { |record| record.name == name }
|
|
34
40
|
end
|
|
35
41
|
|
|
36
42
|
def add_record(record)
|
data/lib/casdoor/transaction.rb
CHANGED
|
@@ -33,8 +33,10 @@ module Casdoor
|
|
|
33
33
|
get_object('get-transaction', Transaction, 'id' => get_id(name))
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
+
# Casdoor has no get-user-transactions API, get-transactions filters the transactions by user
|
|
36
37
|
def get_user_transactions(user_name)
|
|
37
|
-
get_objects('get-
|
|
38
|
+
get_objects('get-transactions', Transaction, 'owner' => organization_name, 'field' => 'user',
|
|
39
|
+
'value' => user_name)
|
|
38
40
|
end
|
|
39
41
|
|
|
40
42
|
def update_transaction(transaction)
|
data/lib/casdoor/version.rb
CHANGED