graph_starter 0.13.8 → 0.13.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +6 -9
  3. data/app/models/concerns/graph_starter/authorizable.rb +2 -2
  4. data/lib/graph_starter/version.rb +1 -1
  5. data/spec/asset_authorization_spec.rb +46 -0
  6. data/{test → spec}/dummy/README.rdoc +0 -0
  7. data/{test → spec}/dummy/Rakefile +0 -0
  8. data/{test → spec}/dummy/app/assets/javascripts/application.js +0 -0
  9. data/{test → spec}/dummy/app/assets/stylesheets/application.css +0 -0
  10. data/{test → spec}/dummy/app/controllers/application_controller.rb +0 -0
  11. data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
  12. data/spec/dummy/app/models/company.rb +5 -0
  13. data/spec/dummy/app/models/person.rb +8 -0
  14. data/spec/dummy/app/models/user.rb +6 -0
  15. data/{test → spec}/dummy/app/views/layouts/application.html.erb +0 -0
  16. data/{test → spec}/dummy/bin/bundle +0 -0
  17. data/{test → spec}/dummy/bin/rails +0 -0
  18. data/{test → spec}/dummy/bin/rake +0 -0
  19. data/{test → spec}/dummy/bin/setup +0 -0
  20. data/{test → spec}/dummy/config.ru +0 -0
  21. data/{test → spec}/dummy/config/application.rb +6 -2
  22. data/{test → spec}/dummy/config/boot.rb +0 -0
  23. data/{test → spec}/dummy/config/environment.rb +0 -0
  24. data/{test → spec}/dummy/config/environments/development.rb +0 -3
  25. data/{test → spec}/dummy/config/environments/production.rb +0 -3
  26. data/{test → spec}/dummy/config/environments/test.rb +0 -0
  27. data/{test → spec}/dummy/config/initializers/assets.rb +0 -0
  28. data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
  29. data/{test → spec}/dummy/config/initializers/cookies_serializer.rb +0 -0
  30. data/{test → spec}/dummy/config/initializers/filter_parameter_logging.rb +0 -0
  31. data/spec/dummy/config/initializers/graph_starter.rb +3 -0
  32. data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
  33. data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
  34. data/{test → spec}/dummy/config/initializers/session_store.rb +0 -0
  35. data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +0 -0
  36. data/{test → spec}/dummy/config/locales/en.yml +0 -0
  37. data/spec/dummy/config/routes.rb +56 -0
  38. data/{test → spec}/dummy/config/secrets.yml +2 -2
  39. data/spec/dummy/log/test.log +246 -0
  40. data/{test → spec}/dummy/public/404.html +0 -0
  41. data/{test → spec}/dummy/public/422.html +0 -0
  42. data/{test → spec}/dummy/public/500.html +0 -0
  43. data/{test → spec}/dummy/public/favicon.ico +0 -0
  44. data/spec/rails_helper.rb +50 -0
  45. data/spec/spec_helper.rb +92 -0
  46. metadata +125 -75
  47. data/test/dummy/config/database.yml +0 -25
  48. data/test/dummy/config/routes.rb +0 -4
  49. data/test/graph_starter_test.rb +0 -7
  50. data/test/integration/navigation_test.rb +0 -10
  51. data/test/test_helper.rb +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2606c830993056abd903e95e71af95ac7f119841
4
- data.tar.gz: fc6da0e37f60084ba3277d1eda53b81d83f2ecbd
3
+ metadata.gz: feef09140d10b28ee5ca6709777b87788bd1df6b
4
+ data.tar.gz: 184aed9f1240d516403b4eb74c0456dc342f683d
5
5
  SHA512:
6
- metadata.gz: 79f13d45e00136102e069bd7d933ed00cc758ac2f76e94fbf0a9068141e005281403c416dfd0e6a24d6cccbe61ebefcf372c0d99a14c4927083941fb387b7104
7
- data.tar.gz: b1806dec0a87509be74482ec525ada25c6d8cb7f1ebabf5961b75e07dfbc2bba13e967bd093e7611c2c1ca85ff77405ac64df9701e62ac4b79ccdaed657e8299
6
+ metadata.gz: 63b22e0a72db950b7e8bb9d8186dfa75c800868cac515b81f943dec1a3452fe27ac04c8cba2343dc4c1bc869f47ba53a64f0e830e4332d832a84a09d310f6e85
7
+ data.tar.gz: 7281d302157f7f4bfec6a56142483037bb2306a8be6171685b2346cf97424b72d5d19415dc6d516205b084b6bd194eca6cc876749539d444787a55ddd86959eb
data/Rakefile CHANGED
@@ -14,24 +14,21 @@ RDoc::Task.new(:rdoc) do |rdoc|
14
14
  rdoc.rdoc_files.include('lib/**/*.rb')
15
15
  end
16
16
 
17
- APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
17
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
18
  load 'rails/tasks/engine.rake'
19
19
 
20
20
 
21
21
  load 'rails/tasks/statistics.rake'
22
22
 
23
23
 
24
-
25
24
  Bundler::GemHelper.install_tasks
26
25
 
27
- require 'rake/testtask'
26
+ Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each {|f| load f }
28
27
 
29
- Rake::TestTask.new(:test) do |t|
30
- t.libs << 'lib'
31
- t.libs << 'test'
32
- t.pattern = 'test/**/*_test.rb'
33
- t.verbose = false
34
- end
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
35
30
 
31
+ desc "Run all specs in spec directory (excluding plugin specs)"
32
+ RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare')
36
33
 
37
34
  task default: :test
@@ -7,10 +7,10 @@ module GraphStarter
7
7
  validates :private, inclusion: {in: [true, false]}
8
8
 
9
9
  if GraphStarter.configuration.user_class
10
- has_many :in, :allowed_users, rel_class: :CanAccess, model_class: GraphStarter.configuration.user_class
10
+ has_many :in, :allowed_users, rel_class: :'GraphStarter::CanAccess', model_class: GraphStarter.configuration.user_class
11
11
  end
12
12
 
13
- has_many :in, :allowed_groups, rel_class: :CanAccess, model_class: :'GraphStarter::Group'
13
+ has_many :in, :allowed_groups, rel_class: :'GraphStarter::CanAccess', model_class: :'GraphStarter::Group'
14
14
  end
15
15
 
16
16
  def set_access_levels(model, access_levels)
@@ -1,3 +1,3 @@
1
1
  module GraphStarter
2
- VERSION = "0.13.8"
2
+ VERSION = "0.13.9"
3
3
  end
@@ -0,0 +1,46 @@
1
+ require './spec/rails_helper'
2
+
3
+ describe 'Asset authorization' do
4
+ before { clear_db }
5
+
6
+ let(:current_user) { nil }
7
+ let(:asset_attributes) { {} }
8
+ let(:asset) { Person.create(asset_attributes) }
9
+
10
+ subject { Person.authorized_for(current_user) }
11
+
12
+ it { should include(asset) }
13
+
14
+ context 'private asset' do
15
+ let(:asset_attributes) { {private: true} }
16
+ it { should_not include(asset) }
17
+
18
+ context 'user is logged in' do
19
+ let(:current_user_attributes) { {} }
20
+ let(:current_user) { User.create(current_user_attributes) }
21
+
22
+ it { should_not include(asset) }
23
+
24
+ context 'current_user is admin' do
25
+ let(:current_user_attributes) { {admin: true} }
26
+ it { should include(asset) }
27
+ end
28
+
29
+ context 'user has access to asset' do
30
+ before { asset.allowed_users = current_user }
31
+ it { should include(asset) }
32
+ end
33
+
34
+ context 'user has access to one of the asset categories' do
35
+ let(:category) { Company.create(name: 'Acme Inc. Co.') }
36
+
37
+ before do
38
+ asset.employer = category
39
+ category.allowed_users = current_user
40
+ end
41
+
42
+ it { should include(asset) }
43
+ end
44
+ end
45
+ end
46
+ end
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ class Company < GraphStarter::Asset
2
+ property :name
3
+
4
+ has_many :in, :employees, origin: :employer, model_class: :Person
5
+ end
@@ -0,0 +1,8 @@
1
+ class Person < GraphStarter::Asset
2
+ property :name, type: String
3
+ property :age, type: Integer
4
+
5
+ has_one :out, :employer, type: :WORKS_AT, model_class: :Company
6
+
7
+ category_associations :employer
8
+ end
@@ -0,0 +1,6 @@
1
+ class User
2
+ include Neo4j::ActiveNode
3
+
4
+ property :username, type: String
5
+ property :admin, type: Boolean
6
+ end
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,6 +1,11 @@
1
1
  require File.expand_path('../boot', __FILE__)
2
2
 
3
- require 'rails/all'
3
+ # Pick the frameworks you want:
4
+ require "action_controller/railtie"
5
+ require "action_mailer/railtie"
6
+ require "action_view/railtie"
7
+ require "sprockets/railtie"
8
+ # require "rails/test_unit/railtie"
4
9
 
5
10
  Bundler.require(*Rails.groups)
6
11
  require "graph_starter"
@@ -20,7 +25,6 @@ module Dummy
20
25
  # config.i18n.default_locale = :de
21
26
 
22
27
  # Do not swallow errors in after_commit/after_rollback callbacks.
23
- config.neo4j.include_root_in_json = false
24
28
  end
25
29
  end
26
30
 
File without changes
File without changes
@@ -19,9 +19,6 @@ Rails.application.configure do
19
19
  # Print deprecation notices to the Rails logger.
20
20
  config.active_support.deprecation = :log
21
21
 
22
- # Raise an error on page load if there are pending migrations.
23
- config.active_record.migration_error = :page_load
24
-
25
22
  # Debug mode disables concatenation and preprocessing of assets.
26
23
  # This option may cause significant delays in view rendering with a large
27
24
  # number of complex assets.
@@ -73,7 +73,4 @@ Rails.application.configure do
73
73
 
74
74
  # Use default logging formatter so that PID and timestamp are not suppressed.
75
75
  config.log_formatter = ::Logger::Formatter.new
76
-
77
- # Do not dump schema after migrations.
78
- config.active_record.dump_schema_after_migration = false
79
76
  end
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ GraphStarter.configure do |config|
2
+ config.user_class = :User
3
+ end
File without changes
@@ -0,0 +1,56 @@
1
+ Rails.application.routes.draw do
2
+ # The priority is based upon order of creation: first created -> highest priority.
3
+ # See how all your routes lay out with "rake routes".
4
+
5
+ # You can have the root of your site routed with "root"
6
+ # root 'welcome#index'
7
+
8
+ # Example of regular route:
9
+ # get 'products/:id' => 'catalog#view'
10
+
11
+ # Example of named route that can be invoked with purchase_url(id: product.id)
12
+ # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
13
+
14
+ # Example resource route (maps HTTP verbs to controller actions automatically):
15
+ # resources :products
16
+
17
+ # Example resource route with options:
18
+ # resources :products do
19
+ # member do
20
+ # get 'short'
21
+ # post 'toggle'
22
+ # end
23
+ #
24
+ # collection do
25
+ # get 'sold'
26
+ # end
27
+ # end
28
+
29
+ # Example resource route with sub-resources:
30
+ # resources :products do
31
+ # resources :comments, :sales
32
+ # resource :seller
33
+ # end
34
+
35
+ # Example resource route with more complex sub-resources:
36
+ # resources :products do
37
+ # resources :comments
38
+ # resources :sales do
39
+ # get 'recent', on: :collection
40
+ # end
41
+ # end
42
+
43
+ # Example resource route with concerns:
44
+ # concern :toggleable do
45
+ # post 'toggle'
46
+ # end
47
+ # resources :posts, concerns: :toggleable
48
+ # resources :photos, concerns: :toggleable
49
+
50
+ # Example resource route within a namespace:
51
+ # namespace :admin do
52
+ # # Directs /admin/products/* to Admin::ProductsController
53
+ # # (app/controllers/admin/products_controller.rb)
54
+ # resources :products
55
+ # end
56
+ end
@@ -11,10 +11,10 @@
11
11
  # if you're sharing your code publicly.
12
12
 
13
13
  development:
14
- secret_key_base: d77964902affb127be0c9f6c4de7a2bd9727cb922c07ed0e2d304b3f20c13f67c71c15c3ef4afca3dfba0f36dc082ecfa7c22b732fc15611b3650f256ee1d655
14
+ secret_key_base: d167455bcc806a4c6bf9d696bad6d8f529096d373b318dccc6c574a39617d1339ccca0db975697e6dcae36a77ba623200ed146c2cae4e4979d9501f48fba1c67
15
15
 
16
16
  test:
17
- secret_key_base: 15c0c6023ccf202c48219c73d11c0d25d4466278465a51a74a1dd9376647dca11e590e3249145067cd75f800ccbad16bcf9d9d019288b2fb2cda69dcc2fde910
17
+ secret_key_base: b603e413a3e60e92ec45b78652f7f5750f7e3cdefaa2f2e9e21419d7306b48d1f0e3b577155d58e4604d6805a07e47d9c48aea30d727fd24e10e23df10e4b2e6
18
18
 
19
19
  # Do not keep production secrets in the repository,
20
20
  # instead read values from the environment.
@@ -0,0 +1,246 @@
1
+ CYPHER 1118ms CREATE CONSTRAINT ON (n:`GraphStarter::Asset`) ASSERT n.`uuid` IS UNIQUE
2
+ CYPHER 866ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"c543db9a-e0d1-4e3c-90ca-d76b8a2ca06f", :created_at=>1448517404, :updated_at=>1448517404, :private=>false}}
3
+ Person 695ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7446}
4
+ CYPHER 3ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"5e83114a-aaa5-4b4e-8641-a3fe8615e449", :created_at=>1448517406, :updated_at=>1448517406, :private=>true}}
5
+ Person 4ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7447}
6
+ Person 109ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>[]}
7
+ CYPHER 3ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"5293ec0d-87cd-4b7d-89df-b41cd6442318", :created_at=>1448517415, :updated_at=>1448517415, :private=>false}}
8
+ Person 141ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7448}
9
+ CYPHER 3ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"f339ef50-a6c3-4211-ae06-195d735a701e", :created_at=>1448517415, :updated_at=>1448517415, :private=>true}}
10
+ Person 4ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7449}
11
+ Person 167ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>[]}
12
+ CYPHER 3ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"5211a5af-a4d1-4d6e-913e-6c4e6e272170", :created_at=>1448517422, :updated_at=>1448517422, :private=>false}}
13
+ Person 191ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7450}
14
+ CYPHER 2ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"80001852-fad8-44e3-9df2-e3b7be2b2940", :created_at=>1448517423, :updated_at=>1448517423, :private=>true}}
15
+ Person 9ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7451}
16
+ Person 129ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>[]}
17
+ CYPHER 422ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
18
+ CYPHER 8ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"e6b116e5-1e37-4d4e-89ad-bc11dbb7b6ab", :created_at=>1448517525, :updated_at=>1448517525, :private=>false}}
19
+ Person 286ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7452}
20
+ CYPHER 33ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
21
+ CYPHER 3ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"8a2ffb32-c943-460c-b56a-50f3941f0fc5", :created_at=>1448517526, :updated_at=>1448517526, :private=>true}}
22
+ Person 4ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7453}
23
+ Person 350ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>[]}
24
+ CYPHER 6ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
25
+ CYPHER 4ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"cf157b2f-deb0-4ca6-a9a4-d10b0b9b2a4b", :created_at=>1448517532, :updated_at=>1448517532, :private=>false}}
26
+ Person 3ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7454}
27
+ CYPHER 9ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
28
+ CYPHER 6ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"4ff4fee5-f38b-4467-8d78-8d214bf2abd8", :created_at=>1448517532, :updated_at=>1448517532, :private=>true}}
29
+ Person 6ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7455}
30
+ Person 5ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>[]}
31
+ CYPHER 16ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
32
+ CYPHER 8ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"d62b185a-631e-4319-b930-bd02c95b13f8", :created_at=>1448517537, :updated_at=>1448517537, :private=>false}}
33
+ Person 11ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7456}
34
+ CYPHER 6ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
35
+ CYPHER 4ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"01361e85-ff14-4e7d-9a31-c6fe57c084a3", :created_at=>1448517537, :updated_at=>1448517537, :private=>true}}
36
+ Person 10ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7457}
37
+ Person 8ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>[]}
38
+ CYPHER 21ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
39
+ CYPHER 17ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"032371cb-ccb1-46c7-9dc7-d1af477b23c5", :created_at=>1448517631, :updated_at=>1448517631, :private=>false}}
40
+ Person 20ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7458}
41
+ CYPHER 3ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
42
+ CYPHER 2ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"5df502a3-dda2-446f-a0ee-52e2d4153049", :created_at=>1448517631, :updated_at=>1448517631, :private=>true}}
43
+ Person 4ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7459}
44
+ Person 5ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>[]}
45
+ CYPHER 3ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
46
+ CYPHER 4ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"5f701e4c-e8a8-4dc7-8ad2-09ad43405010", :created_at=>1448517631, :updated_at=>1448517631, :private=>true}}
47
+ CYPHER 43ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"f8d0576e-9f94-4d37-8f39-3deb70f22d9b", :admin=>true}}
48
+ Person 496ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7461, :other_node_id=>7460}
49
+ CYPHER 40ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
50
+ CYPHER 19ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"d640e239-5200-4f7c-af71-be08748f9b1f", :created_at=>1448517826, :updated_at=>1448517826, :private=>false}}
51
+ Person 13ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7462}
52
+ CYPHER 3ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
53
+ CYPHER 4ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"33ad26b0-5882-42db-bbf6-338ac9b76312", :created_at=>1448517826, :updated_at=>1448517826, :private=>true}}
54
+ Person 4ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7463}
55
+ Person 4ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>[]}
56
+ CYPHER 6ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
57
+ CYPHER 2ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"28351a34-5148-4d94-9197-8b66f0d12bc8", :created_at=>1448517826, :updated_at=>1448517826, :private=>true}}
58
+ CYPHER 3ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"823a0ea7-d1e7-403b-8467-36fa3618911f"}}
59
+ Person 293ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7465, :other_node_id=>7464}
60
+ Person 221ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>7465}
61
+ CYPHER 7ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
62
+ CYPHER 8ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"8a22c71f-166b-4487-8ddb-ae5c409242e6", :created_at=>1448517827, :updated_at=>1448517827, :private=>true}}
63
+ CYPHER 17ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"59eaafba-0618-4c39-8ac0-c5420b01fea9", :admin=>true}}
64
+ Person 4ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7467, :other_node_id=>7466}
65
+ CYPHER 28ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
66
+ CYPHER 2ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
67
+ CYPHER 7ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"36973758-6c87-44ab-b445-ba5b70ee771f", :created_at=>1448518087, :updated_at=>1448518087, :private=>true}}
68
+ Person 12ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7468}
69
+ Person 4ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>[]}
70
+ CYPHER 7ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
71
+ CYPHER 3ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"7b621fc1-1770-414d-94d3-0ba76a8597da", :created_at=>1448518087, :updated_at=>1448518087, :private=>true}}
72
+ CYPHER 2ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"ef405ac0-aa46-4bde-8ea4-d0ecdf3a8d8a"}}
73
+ Person 487ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7470, :other_node_id=>7469}
74
+ Person 631ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>7470}
75
+ CYPHER 7ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
76
+ CYPHER 7ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"d37678a6-9034-4140-8b98-65bb9fd2ffea", :created_at=>1448518088, :updated_at=>1448518088, :private=>true}}
77
+ CYPHER 3ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"c0e4c473-722b-45df-ad3c-59c9035493c6", :admin=>true}}
78
+ Person 6ms MATCH (asset:`Person`:`Asset`) WITH asset OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level]) AS level_collections, asset UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7472, :other_node_id=>7471}
79
+ CYPHER 6ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
80
+ CYPHER 3ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"c16202b1-f98f-4ec4-bfbc-4c13d0c0eb9e", :created_at=>1448518088, :updated_at=>1448518088, :private=>true}}
81
+ CYPHER 32ms CREATE (n:`Company`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"498e0268-b88c-469e-961d-d92987d8d300", :created_at=>1448518088, :updated_at=>1448518088, :private=>false, :name=>"Acme Inc. Co."}}
82
+ Person#employer 100ms MATCH person7473 WHERE (ID(person7473) = {ID_person7473}) MATCH person7473-[rel1:`WORKS_AT`]->(result_employer:`Company`:`Asset`) DELETE rel1 | {:ID_person7473=>7473}
83
+ CYPHER 79ms MATCH from_node, to_node WHERE (ID(from_node) = {ID_from_node}) AND (ID(to_node) = {ID_to_node}) CREATE from_node-[rel:WORKS_AT {rel_create_props}]->to_node | {:ID_from_node=>7473, :ID_to_node=>7474, :rel_create_props=>{}}
84
+ CYPHER 2ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"d8480d03-845f-4c8a-9f2b-8292f6741bc3"}}
85
+ CYPHER 11ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
86
+ CYPHER 4ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"4e6f5feb-4fbd-42fa-b1ed-5718470558fd", :created_at=>1448518121, :updated_at=>1448518121, :private=>false}}
87
+ Person 596ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7476}
88
+ CYPHER 3ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
89
+ CYPHER 4ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"739a0dc4-30e3-48a5-8b73-87ef02cf5d41", :created_at=>1448518122, :updated_at=>1448518122, :private=>true}}
90
+ Person 3ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7477}
91
+ Person 257ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>[]}
92
+ CYPHER 7ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
93
+ CYPHER 3ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"c7449d03-65c6-4631-8bab-f9990c080852", :created_at=>1448518122, :updated_at=>1448518122, :private=>true}}
94
+ CYPHER 5ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"2fc3e244-e7c1-40eb-aeff-446db756753d"}}
95
+ Person 1033ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7479, :other_node_id=>7478}
96
+ Person 347ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>7479}
97
+ CYPHER 13ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
98
+ CYPHER 10ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"35f65ca1-5fdc-4d0f-b698-2a7426676ed9", :created_at=>1448518124, :updated_at=>1448518124, :private=>true}}
99
+ CYPHER 3ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"8def4d20-b8c6-459a-a1d8-b3050bef66ad", :admin=>true}}
100
+ Person 4ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7481, :other_node_id=>7480}
101
+ CYPHER 4ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
102
+ CYPHER 3ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"31c9051d-6033-42b6-b1b7-89023b72715f", :created_at=>1448518124, :updated_at=>1448518124, :private=>true}}
103
+ CYPHER 4ms CREATE (n:`Company`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"05fd20f1-7f49-4091-ad3c-d18edfc66d1a", :created_at=>1448518124, :updated_at=>1448518124, :private=>false, :name=>"Acme Inc. Co."}}
104
+ Person#employer 27ms MATCH person7482 WHERE (ID(person7482) = {ID_person7482}) MATCH person7482-[rel1:`WORKS_AT`]->(result_employer:`Company`:`Asset`) DELETE rel1 | {:ID_person7482=>7482}
105
+ CYPHER 2ms MATCH from_node, to_node WHERE (ID(from_node) = {ID_from_node}) AND (ID(to_node) = {ID_to_node}) CREATE from_node-[rel:WORKS_AT {rel_create_props}]->to_node | {:ID_from_node=>7482, :ID_to_node=>7483, :rel_create_props=>{}}
106
+ CYPHER 2ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"22e92dcc-635e-4343-8a68-958d032d227e"}}
107
+ CYPHER 64ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
108
+ CYPHER 15ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"15a8f0e0-043e-4538-8ea7-f59e184e0037", :created_at=>1448518318, :updated_at=>1448518318, :private=>false}}
109
+ Person 30ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7485}
110
+ CYPHER 13ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
111
+ CYPHER 5ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"bf714660-56d9-44a6-8ed1-6f75745cd6ac", :created_at=>1448518318, :updated_at=>1448518318, :private=>true}}
112
+ Person 8ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7486}
113
+ Person 5ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>[]}
114
+ CYPHER 7ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
115
+ CYPHER 3ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"eb5bbd27-2ac0-4780-8d48-cc1817e68368", :created_at=>1448518318, :updated_at=>1448518318, :private=>true}}
116
+ CYPHER 4ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"28cd917b-1411-45e4-8241-461c31dee90e"}}
117
+ Person 8ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7488, :other_node_id=>7487}
118
+ Person 5ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>7488}
119
+ CYPHER 9ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
120
+ CYPHER 2ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"602a2838-cab7-4892-9e74-a6c4ca54134a", :created_at=>1448518318, :updated_at=>1448518318, :private=>true}}
121
+ CYPHER 2ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"918c7960-5680-4e6d-a73a-16065d3e2632", :admin=>true}}
122
+ Person 3ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7490, :other_node_id=>7489}
123
+ CYPHER 7ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
124
+ CYPHER 3ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"5720fbed-c28e-4359-bea0-7a946cacd404", :created_at=>1448518318, :updated_at=>1448518318, :private=>true}}
125
+ CYPHER 3ms CREATE (n:`Company`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"168e7dfe-0d4d-4662-b171-3a2120c08c87", :created_at=>1448518318, :updated_at=>1448518318, :private=>false, :name=>"Acme Inc. Co."}}
126
+ Person#employer 79ms MATCH person7491 WHERE (ID(person7491) = {ID_person7491}) MATCH person7491-[rel1:`WORKS_AT`]->(result_employer:`Company`:`Asset`) DELETE rel1 | {:ID_person7491=>7491}
127
+ CYPHER 16ms MATCH from_node, to_node WHERE (ID(from_node) = {ID_from_node}) AND (ID(to_node) = {ID_to_node}) CREATE from_node-[rel:WORKS_AT {rel_create_props}]->to_node | {:ID_from_node=>7491, :ID_to_node=>7492, :rel_create_props=>{}}
128
+ CYPHER 3ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"e3d22a5a-5948-4efc-b14a-a1216accdee9"}}
129
+ Person 69ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7493, :other_node_id=>7491}
130
+ CYPHER 24ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
131
+ CYPHER 8ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"d32c27a7-d17c-4e84-b01a-c07449204de8", :created_at=>1448518384, :updated_at=>1448518384, :private=>false}}
132
+ Person 11ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7494}
133
+ CYPHER 3ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
134
+ CYPHER 3ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"2763edea-582c-43b9-a399-ae75a912e123", :created_at=>1448518384, :updated_at=>1448518384, :private=>true}}
135
+ Person 4ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7495}
136
+ Person 3ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>[]}
137
+ CYPHER 4ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
138
+ CYPHER 2ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"96542bad-ef23-42a7-a62b-c45f9f14b6fe", :created_at=>1448518384, :updated_at=>1448518384, :private=>true}}
139
+ CYPHER 2ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"6b28f557-a920-49db-a752-fc4e4951a5e5"}}
140
+ Person 3ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7497, :other_node_id=>7496}
141
+ Person 4ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>7497}
142
+ CYPHER 4ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
143
+ CYPHER 2ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"0f1e11bc-c55f-4dc6-bc56-8a2e14d09ee0", :created_at=>1448518384, :updated_at=>1448518384, :private=>true}}
144
+ CYPHER 3ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"2769afb2-ead3-4c23-96b6-66a3e45499db", :admin=>true}}
145
+ Person 3ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7499, :other_node_id=>7498}
146
+ CYPHER 4ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
147
+ CYPHER 2ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"12f5b73a-c1a3-4217-8ee1-62168c9bff5b", :created_at=>1448518384, :updated_at=>1448518384, :private=>true}}
148
+ CYPHER 5ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
149
+ CYPHER 2ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"44d17e82-34b6-42dd-a4d2-dc0fa73dc903", :created_at=>1448518385, :updated_at=>1448518385, :private=>true}}
150
+ CYPHER 2ms CREATE (n:`Company`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"66f457bd-e6c3-4a9b-a7b3-9d46409bda43", :created_at=>1448518385, :updated_at=>1448518385, :private=>false, :name=>"Acme Inc. Co."}}
151
+ Person#employer 43ms MATCH person7501 WHERE (ID(person7501) = {ID_person7501}) MATCH person7501-[rel1:`WORKS_AT`]->(result_employer:`Company`:`Asset`) DELETE rel1 | {:ID_person7501=>7501}
152
+ CYPHER 2ms MATCH from_node, to_node WHERE (ID(from_node) = {ID_from_node}) AND (ID(to_node) = {ID_to_node}) CREATE from_node-[rel:WORKS_AT {rel_create_props}]->to_node | {:ID_from_node=>7501, :ID_to_node=>7502, :rel_create_props=>{}}
153
+ CYPHER 2ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"f301b0df-c6cf-48dd-9164-e2ddb10854a4"}}
154
+ CYPHER 22ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
155
+ CYPHER 7ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"dec39076-27f1-4575-8f54-c31a21cbfb73", :created_at=>1448518450, :updated_at=>1448518450, :private=>false}}
156
+ Person 13ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7504}
157
+ CYPHER 3ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
158
+ CYPHER 2ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"cfc4f4e1-7061-47d9-a3ff-5d03c2ad9b32", :created_at=>1448518450, :updated_at=>1448518450, :private=>true}}
159
+ Person 5ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7505}
160
+ Person 5ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>[]}
161
+ CYPHER 4ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
162
+ CYPHER 2ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"ffcbb76d-b1c2-4e14-bbc8-4e9864b1113c", :created_at=>1448518450, :updated_at=>1448518450, :private=>true}}
163
+ CYPHER 3ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"a6fb66a1-5513-4c12-9ac5-275b6af85597"}}
164
+ Person 3ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7507, :other_node_id=>7506}
165
+ Person 5ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>7507}
166
+ CYPHER 4ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
167
+ CYPHER 3ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"74377e81-3687-441d-8442-77f171aa65c7", :created_at=>1448518450, :updated_at=>1448518450, :private=>true}}
168
+ CYPHER 3ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"f8b3f880-13b3-41f9-ba2d-4dc9b5106a51", :admin=>true}}
169
+ Person 5ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7509, :other_node_id=>7508}
170
+ CYPHER 3ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
171
+ CYPHER 3ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"ece308e7-19cf-4d75-86e2-6761589392c6", :created_at=>1448518450, :updated_at=>1448518450, :private=>true}}
172
+ Person#allowed_users 50ms MATCH person7510 WHERE (ID(person7510) = {ID_person7510}) MATCH person7510<-[rel1:`CAN_ACCESS`]-(result_allowed_users:`User`) DELETE rel1 | {:ID_person7510=>7510}
173
+ CYPHER 9ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"75771fc0-5f78-4fe0-a591-ff6ec9c20ed5"}}
174
+ Person 8ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7511, :other_node_id=>7510}
175
+ Person 5ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>7511}
176
+ CYPHER 6ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
177
+ CYPHER 3ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"98c7fbfb-4b56-407c-a6b2-488a52e7f431", :created_at=>1448518450, :updated_at=>1448518450, :private=>true}}
178
+ CYPHER 3ms CREATE (n:`Company`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"a3d9fa91-8ca5-4e81-b347-c09c4ac4d34f", :created_at=>1448518450, :updated_at=>1448518450, :private=>false, :name=>"Acme Inc. Co."}}
179
+ Person#employer 15ms MATCH person7512 WHERE (ID(person7512) = {ID_person7512}) MATCH person7512-[rel1:`WORKS_AT`]->(result_employer:`Company`:`Asset`) DELETE rel1 | {:ID_person7512=>7512}
180
+ CYPHER 2ms MATCH from_node, to_node WHERE (ID(from_node) = {ID_from_node}) AND (ID(to_node) = {ID_to_node}) CREATE from_node-[rel:WORKS_AT {rel_create_props}]->to_node | {:ID_from_node=>7512, :ID_to_node=>7513, :rel_create_props=>{}}
181
+ CYPHER 2ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"3a6cb0cb-f00f-43be-9934-d30a02e41d17"}}
182
+ Company#allowed_users 9ms MATCH company7513 WHERE (ID(company7513) = {ID_company7513}) MATCH company7513<-[rel1:`CAN_ACCESS`]-(result_allowed_users:`User`) DELETE rel1 | {:ID_company7513=>7513}
183
+ CYPHER 204ms MATCH (from_node), (to_node) WHERE (ID(from_node) = {from_node_id}) AND (ID(to_node) = {to_node_id}) CREATE UNIQUE from_node-[rel:CAN_ACCESS {rel_create_props}]->to_node SET rel.`level` = {setter_rel_level} RETURN rel | {:from_node_id=>7514, :to_node_id=>7513, :setter_rel_level=>"read", :rel_create_props=>{}}
184
+ Person 13ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7514, :other_node_id=>7512}
185
+ CYPHER 7ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
186
+ CYPHER 4ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"1b48ff3f-3583-41ff-a587-49db36f06e6e", :created_at=>1448518464, :updated_at=>1448518464, :private=>false}}
187
+ Person 4ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7515}
188
+ CYPHER 4ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
189
+ CYPHER 3ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"e09ea820-30a2-4b4c-8e7b-189ac63eaa98", :created_at=>1448518464, :updated_at=>1448518464, :private=>true}}
190
+ Person 23ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7516}
191
+ Person 23ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>[]}
192
+ CYPHER 5ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
193
+ CYPHER 2ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"4d6d6445-6d6b-4f2b-bbd7-c920385ca5d0", :created_at=>1448518464, :updated_at=>1448518464, :private=>true}}
194
+ CYPHER 4ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"220047fb-fa43-4f9d-b3d2-d1191bfabd57"}}
195
+ Person 10ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7518, :other_node_id=>7517}
196
+ Person 8ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>7518}
197
+ CYPHER 4ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
198
+ CYPHER 2ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"a181ba24-a546-4d90-9fe4-5e455e6ac55d", :created_at=>1448518464, :updated_at=>1448518464, :private=>true}}
199
+ CYPHER 4ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"e1d766bd-744a-4cca-8b89-914361bd3301", :admin=>true}}
200
+ Person 3ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7520, :other_node_id=>7519}
201
+ CYPHER 4ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
202
+ CYPHER 2ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"2a732e54-94e4-424c-9397-b58cea4452d0", :created_at=>1448518464, :updated_at=>1448518464, :private=>true}}
203
+ Person#allowed_users 16ms MATCH person7521 WHERE (ID(person7521) = {ID_person7521}) MATCH person7521<-[rel1:`CAN_ACCESS`]-(result_allowed_users:`User`) DELETE rel1 | {:ID_person7521=>7521}
204
+ CYPHER 2ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"70ba4334-3e4a-4d60-80f1-3a01d571376e"}}
205
+ Person 3ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7522, :other_node_id=>7521}
206
+ Person 3ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>7522}
207
+ CYPHER 6ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
208
+ CYPHER 2ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"4b3c310b-4499-40e6-ae1c-121b2f1fdebd", :created_at=>1448518464, :updated_at=>1448518464, :private=>true}}
209
+ CYPHER 2ms CREATE (n:`Company`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"203815ab-4f87-40c0-a6f6-7a416752770b", :created_at=>1448518464, :updated_at=>1448518464, :private=>false, :name=>"Acme Inc. Co."}}
210
+ Person#employer 12ms MATCH person7523 WHERE (ID(person7523) = {ID_person7523}) MATCH person7523-[rel1:`WORKS_AT`]->(result_employer:`Company`:`Asset`) DELETE rel1 | {:ID_person7523=>7523}
211
+ CYPHER 2ms MATCH from_node, to_node WHERE (ID(from_node) = {ID_from_node}) AND (ID(to_node) = {ID_to_node}) CREATE from_node-[rel:WORKS_AT {rel_create_props}]->to_node | {:ID_from_node=>7523, :ID_to_node=>7524, :rel_create_props=>{}}
212
+ CYPHER 4ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"317daa69-cdbc-4ae3-a9b8-27c693fca38a"}}
213
+ Company#allowed_users 12ms MATCH company7524 WHERE (ID(company7524) = {ID_company7524}) MATCH company7524<-[rel1:`CAN_ACCESS`]-(result_allowed_users:`User`) DELETE rel1 | {:ID_company7524=>7524}
214
+ CYPHER 3ms MATCH (from_node), (to_node) WHERE (ID(from_node) = {from_node_id}) AND (ID(to_node) = {to_node_id}) CREATE UNIQUE from_node-[rel:CAN_ACCESS {rel_create_props}]->to_node SET rel.`level` = {setter_rel_level} RETURN rel | {:from_node_id=>7525, :to_node_id=>7524, :setter_rel_level=>"read", :rel_create_props=>{}}
215
+ Person 4ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7525, :other_node_id=>7523}
216
+ CYPHER 5ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
217
+ CYPHER 3ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"14307d0e-88b1-4de7-b4d7-a3da4798f848", :created_at=>1448518494, :updated_at=>1448518494, :private=>false}}
218
+ Person 4ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7526}
219
+ CYPHER 3ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
220
+ CYPHER 2ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"fc294a13-e19b-486f-941e-fb5fac718ec5", :created_at=>1448518494, :updated_at=>1448518494, :private=>true}}
221
+ Person 3ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>[], :other_node_id=>7527}
222
+ Person 5ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) IN {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>[]}
223
+ CYPHER 4ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
224
+ CYPHER 2ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"fe35d45e-d45f-483c-b058-9ad85a421a59", :created_at=>1448518494, :updated_at=>1448518494, :private=>true}}
225
+ CYPHER 4ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"7ec873a8-d646-4a81-a8eb-2530065ce5eb"}}
226
+ Person 4ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7529, :other_node_id=>7528}
227
+ Person 5ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level RETURN asset | {:ID_user=>7529}
228
+ CYPHER 3ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
229
+ CYPHER 3ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"acca2995-c58e-43c7-9f1d-5d1e34fe70b8", :created_at=>1448518494, :updated_at=>1448518494, :private=>true}}
230
+ CYPHER 2ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"1bb8ccd2-c7a7-45d7-bfad-54dc4eaa5f21", :admin=>true}}
231
+ Person 3ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7531, :other_node_id=>7530}
232
+ CYPHER 4ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
233
+ CYPHER 3ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"0d45d2ac-c494-4913-be5a-cb3fca044abd", :created_at=>1448518494, :updated_at=>1448518494, :private=>true}}
234
+ CYPHER 3ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"16f2f70b-c5f2-4f2e-b2fe-34dd7378bc24"}}
235
+ Person#allowed_users 12ms MATCH person7532 WHERE (ID(person7532) = {ID_person7532}) MATCH person7532<-[rel1:`CAN_ACCESS`]-(result_allowed_users:`User`) DELETE rel1 | {:ID_person7532=>7532}
236
+ CYPHER 11ms MATCH (from_node), (to_node) WHERE (ID(from_node) = {from_node_id}) AND (ID(to_node) = {to_node_id}) CREATE UNIQUE from_node-[rel:CAN_ACCESS {rel_create_props}]->to_node SET rel.`level` = {setter_rel_level} RETURN rel | {:from_node_id=>7533, :to_node_id=>7532, :setter_rel_level=>"read", :rel_create_props=>{}}
237
+ Person 3ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7533, :other_node_id=>7532}
238
+ CYPHER 3ms MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
239
+ CYPHER 2ms CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"413eacbf-9f48-4bdb-8c4c-5dca6f336f7a", :created_at=>1448518494, :updated_at=>1448518494, :private=>true}}
240
+ CYPHER 2ms CREATE (n:`Company`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"ebfaf853-0885-4f90-829a-feef9fb147dd", :created_at=>1448518494, :updated_at=>1448518494, :private=>false, :name=>"Acme Inc. Co."}}
241
+ Person#employer 14ms MATCH person7534 WHERE (ID(person7534) = {ID_person7534}) MATCH person7534-[rel1:`WORKS_AT`]->(result_employer:`Company`:`Asset`) DELETE rel1 | {:ID_person7534=>7534}
242
+ CYPHER 2ms MATCH from_node, to_node WHERE (ID(from_node) = {ID_from_node}) AND (ID(to_node) = {ID_to_node}) CREATE from_node-[rel:WORKS_AT {rel_create_props}]->to_node | {:ID_from_node=>7534, :ID_to_node=>7535, :rel_create_props=>{}}
243
+ CYPHER 2ms CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"735b9601-e353-4df3-9449-7da588e8424f"}}
244
+ Company#allowed_users 11ms MATCH company7535 WHERE (ID(company7535) = {ID_company7535}) MATCH company7535<-[rel1:`CAN_ACCESS`]-(result_allowed_users:`User`) DELETE rel1 | {:ID_company7535=>7535}
245
+ CYPHER 2ms MATCH (from_node), (to_node) WHERE (ID(from_node) = {from_node_id}) AND (ID(to_node) = {to_node_id}) CREATE UNIQUE from_node-[rel:CAN_ACCESS {rel_create_props}]->to_node SET rel.`level` = {setter_rel_level} RETURN rel | {:from_node_id=>7536, :to_node_id=>7535, :setter_rel_level=>"read", :rel_create_props=>{}}
246
+ Person 4ms MATCH (asset:`Person`:`Asset`) OPTIONAL MATCH (asset)-[:`WORKS_AT`]->(category:Company) WITH asset, collect(category) AS categories0 WITH asset, CASE categories0 WHEN [] THEN [null] ELSE categories0 END AS categories0 UNWIND categories0 AS category WITH asset, category OPTIONAL MATCH user WHERE (ID(user) = {ID_user}) OPTIONAL MATCH asset<-[asset_created_rel:CREATED]-user OPTIONAL MATCH asset<-[asset_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH asset<-[asset_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user OPTIONAL MATCH category<-[category_created_rel:CREATED]-user OPTIONAL MATCH category<-[category_direct_access_rel:CAN_ACCESS]-user OPTIONAL MATCH category<-[category_indirect_can_access_rel:CAN_ACCESS]-(:Group)<-[:HAS_SUBGROUP*0..5]-(:Group)<-[:BELONGS_TO]-user WITH * WITH collect([CASE WHEN (user.admin OR asset_created_rel IS NOT NULL) THEN 'write' WHEN NOT(asset.private) THEN 'read' END, asset_direct_access_rel.level, asset_indirect_can_access_rel.level, CASE WHEN (user.admin OR category_created_rel IS NOT NULL) THEN 'write' WHEN NOT(category.private) THEN 'read' END, category_direct_access_rel.level, category_indirect_can_access_rel.level]) AS level_collections, asset, category UNWIND level_collections AS level_collection UNWIND level_collection AS level WITH level, asset, category WHERE NOT(level IS NULL) WITH collect(level) AS levels, asset, category WITH CASE WHEN 'write' IN levels THEN 'write' ELSE 'read' END AS level, asset, category WITH DISTINCT asset AS asset, level WHERE (ID(asset) = {other_node_id}) RETURN count(asset) as count | {:ID_user=>7536, :other_node_id=>7534}