public void GrantPermission(ICanJoinKey grantedToKey, ICanBeGrantedKey grantedKey, string action) { _client.Cypher .MergeKey(grantedToKey, "grantedToKey") .MergeKey(grantedKey, "grantedKey") .Merge("(grantedToKey) - [:GRANT {action: {action}}] -> (grantedKey)") .WithParam("action", action) .ExecuteWithoutResults(); }
public bool CanItAccess(ICanJoinKey accessor, ICanBeGrantedKey thing, string action) { return(_client.Cypher .MergeKey(accessor, "accessor") .MergeKey(thing, "thing") .With("accessor,thing") .Match("(accessor) - [:MEMBER *0..] -> () - [g:GRANT {action: {action}}] -> (thing)") .WithParam("action", action) .Return <bool>("count(g) > 0"). Results. First()); }