-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
02c21c1
commit 890c762
Showing
10 changed files
with
372 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import json | ||
from indykite_sdk.model.authorization_policy_config_status import Status | ||
|
||
|
||
class AuthorizationPolicyConfig: | ||
@classmethod | ||
def deserialize(cls, message_config): | ||
if message_config is None: | ||
return None | ||
fields = [desc.name for desc, val in message_config.ListFields()] | ||
authorization_policy_config = AuthorizationPolicyConfig( | ||
policy=json.loads(message_config.policy) | ||
) | ||
if "status" in fields: | ||
authorization_policy_config.status = \ | ||
Status[message_config.status].name | ||
if "tags" in fields: | ||
authorization_policy_config.tags = [ | ||
str(t) | ||
for t in message_config.tags | ||
] | ||
return authorization_policy_config | ||
|
||
def __init__(self, policy, status=None, tags=[]): | ||
|
||
self.policy = policy | ||
self.status = status | ||
self.tags = tags | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from enum import Enum | ||
|
||
|
||
class Status(Enum): | ||
STATUS_INVALID = 0 | ||
STATUS_ACTIVE = 1 | ||
STATUS_INACTIVE = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"meta": { | ||
"policyVersion": "1.0-indykite" | ||
}, | ||
"subject": { | ||
"type": "DigitalTwin" | ||
}, | ||
"actions": [ | ||
"HAS_FREE_PARKING" | ||
], | ||
"resource": { | ||
"type": "ParkingLot" | ||
}, | ||
"condition": { | ||
"cypher": "MATCH(subject:DigitalTwin{digital_twin_id:$subject_id}) MATCH(n1:Household) MATCH(n2:DigitalTwin) MATCH(n3:LoyaltyProgram) MATCH(n4:Mall) MATCH(resource:ParkingLot) MATCH(sub)-[:MEMBER_OF]->(n1) MATCH(n2)-[:MEMBER_OF]->(n1) MATCH(n2)-[:MEMBER_OF]->(n3) MATCH(n4)-[:OFFERS]->(n3) MATCH(resource)-[:OUTSIDE]->(n4)" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"meta": { | ||
"policyVersion": "1.0-indykite" | ||
}, | ||
"subject": { | ||
"type": "DigitalTwin" | ||
}, | ||
"actions": [ | ||
"HAS_FREE_PARKING" | ||
], | ||
"resource": { | ||
"type": "ParkingLot" | ||
}, | ||
"condition": { | ||
"cypher": "MATCH(subject:DigitalTwin{digital_twin_id:$subject_id}) MATCH(n1:Household) MATCH(n2:DigitalTwin) MATCH(n3:LoyaltyProgram) MATCH(n4:Mall) MATCH(resource:ParkingLot) MATCH(sub)-[:MEMBER_OF]->(n1) MATCH(n2)-[:MEMBER_OF]->(n1) MATCH(n2)-[:MEMBER_OF]->(n3) MATCH(n4)-[:OFFERS]->(n3) MATCH(resource)-[:OUTSIDE]->(n4)" | ||
} | ||
} |
Oops, something went wrong.