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.
- checksums.yaml +4 -4
- data/Rakefile +6 -9
- data/app/models/concerns/graph_starter/authorizable.rb +2 -2
- data/lib/graph_starter/version.rb +1 -1
- data/spec/asset_authorization_spec.rb +46 -0
- data/{test → spec}/dummy/README.rdoc +0 -0
- data/{test → spec}/dummy/Rakefile +0 -0
- data/{test → spec}/dummy/app/assets/javascripts/application.js +0 -0
- data/{test → spec}/dummy/app/assets/stylesheets/application.css +0 -0
- data/{test → spec}/dummy/app/controllers/application_controller.rb +0 -0
- data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
- data/spec/dummy/app/models/company.rb +5 -0
- data/spec/dummy/app/models/person.rb +8 -0
- data/spec/dummy/app/models/user.rb +6 -0
- data/{test → spec}/dummy/app/views/layouts/application.html.erb +0 -0
- data/{test → spec}/dummy/bin/bundle +0 -0
- data/{test → spec}/dummy/bin/rails +0 -0
- data/{test → spec}/dummy/bin/rake +0 -0
- data/{test → spec}/dummy/bin/setup +0 -0
- data/{test → spec}/dummy/config.ru +0 -0
- data/{test → spec}/dummy/config/application.rb +6 -2
- data/{test → spec}/dummy/config/boot.rb +0 -0
- data/{test → spec}/dummy/config/environment.rb +0 -0
- data/{test → spec}/dummy/config/environments/development.rb +0 -3
- data/{test → spec}/dummy/config/environments/production.rb +0 -3
- data/{test → spec}/dummy/config/environments/test.rb +0 -0
- data/{test → spec}/dummy/config/initializers/assets.rb +0 -0
- data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/{test → spec}/dummy/config/initializers/cookies_serializer.rb +0 -0
- data/{test → spec}/dummy/config/initializers/filter_parameter_logging.rb +0 -0
- data/spec/dummy/config/initializers/graph_starter.rb +3 -0
- data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
- data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
- data/{test → spec}/dummy/config/initializers/session_store.rb +0 -0
- data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +0 -0
- data/{test → spec}/dummy/config/locales/en.yml +0 -0
- data/spec/dummy/config/routes.rb +56 -0
- data/{test → spec}/dummy/config/secrets.yml +2 -2
- data/spec/dummy/log/test.log +246 -0
- data/{test → spec}/dummy/public/404.html +0 -0
- data/{test → spec}/dummy/public/422.html +0 -0
- data/{test → spec}/dummy/public/500.html +0 -0
- data/{test → spec}/dummy/public/favicon.ico +0 -0
- data/spec/rails_helper.rb +50 -0
- data/spec/spec_helper.rb +92 -0
- metadata +125 -75
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/routes.rb +0 -4
- data/test/graph_starter_test.rb +0 -7
- data/test/integration/navigation_test.rb +0 -10
- data/test/test_helper.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: feef09140d10b28ee5ca6709777b87788bd1df6b
|
4
|
+
data.tar.gz: 184aed9f1240d516403b4eb74c0456dc342f683d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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("../
|
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
|
-
|
26
|
+
Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each {|f| load f }
|
28
27
|
|
29
|
-
|
30
|
-
|
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)
|
@@ -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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
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
|
-
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
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:
|
14
|
+
secret_key_base: d167455bcc806a4c6bf9d696bad6d8f529096d373b318dccc6c574a39617d1339ccca0db975697e6dcae36a77ba623200ed146c2cae4e4979d9501f48fba1c67
|
15
15
|
|
16
16
|
test:
|
17
|
-
secret_key_base:
|
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
|
+
[36mCYPHER[0m [33m1118ms[0m CREATE CONSTRAINT ON (n:`GraphStarter::Asset`) ASSERT n.`uuid` IS UNIQUE
|
2
|
+
[36mCYPHER[0m [33m866ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"c543db9a-e0d1-4e3c-90ca-d76b8a2ca06f", :created_at=>1448517404, :updated_at=>1448517404, :private=>false}}
|
3
|
+
[36mPerson[0m [33m695ms[0m 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
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"5e83114a-aaa5-4b4e-8641-a3fe8615e449", :created_at=>1448517406, :updated_at=>1448517406, :private=>true}}
|
5
|
+
[36mPerson[0m [33m4ms[0m 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
|
+
[36mPerson[0m [33m109ms[0m 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
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"5293ec0d-87cd-4b7d-89df-b41cd6442318", :created_at=>1448517415, :updated_at=>1448517415, :private=>false}}
|
8
|
+
[36mPerson[0m [33m141ms[0m 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
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"f339ef50-a6c3-4211-ae06-195d735a701e", :created_at=>1448517415, :updated_at=>1448517415, :private=>true}}
|
10
|
+
[36mPerson[0m [33m4ms[0m 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
|
+
[36mPerson[0m [33m167ms[0m 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
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"5211a5af-a4d1-4d6e-913e-6c4e6e272170", :created_at=>1448517422, :updated_at=>1448517422, :private=>false}}
|
13
|
+
[36mPerson[0m [33m191ms[0m 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
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"80001852-fad8-44e3-9df2-e3b7be2b2940", :created_at=>1448517423, :updated_at=>1448517423, :private=>true}}
|
15
|
+
[36mPerson[0m [33m9ms[0m 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
|
+
[36mPerson[0m [33m129ms[0m 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
|
+
[36mCYPHER[0m [33m422ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
18
|
+
[36mCYPHER[0m [33m8ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"e6b116e5-1e37-4d4e-89ad-bc11dbb7b6ab", :created_at=>1448517525, :updated_at=>1448517525, :private=>false}}
|
19
|
+
[36mPerson[0m [33m286ms[0m 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
|
+
[36mCYPHER[0m [33m33ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
21
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"8a2ffb32-c943-460c-b56a-50f3941f0fc5", :created_at=>1448517526, :updated_at=>1448517526, :private=>true}}
|
22
|
+
[36mPerson[0m [33m4ms[0m 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
|
+
[36mPerson[0m [33m350ms[0m 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
|
+
[36mCYPHER[0m [33m6ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
25
|
+
[36mCYPHER[0m [33m4ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"cf157b2f-deb0-4ca6-a9a4-d10b0b9b2a4b", :created_at=>1448517532, :updated_at=>1448517532, :private=>false}}
|
26
|
+
[36mPerson[0m [33m3ms[0m 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
|
+
[36mCYPHER[0m [33m9ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
28
|
+
[36mCYPHER[0m [33m6ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"4ff4fee5-f38b-4467-8d78-8d214bf2abd8", :created_at=>1448517532, :updated_at=>1448517532, :private=>true}}
|
29
|
+
[36mPerson[0m [33m6ms[0m 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
|
+
[36mPerson[0m [33m5ms[0m 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
|
+
[36mCYPHER[0m [33m16ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
32
|
+
[36mCYPHER[0m [33m8ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"d62b185a-631e-4319-b930-bd02c95b13f8", :created_at=>1448517537, :updated_at=>1448517537, :private=>false}}
|
33
|
+
[36mPerson[0m [33m11ms[0m 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
|
+
[36mCYPHER[0m [33m6ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
35
|
+
[36mCYPHER[0m [33m4ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"01361e85-ff14-4e7d-9a31-c6fe57c084a3", :created_at=>1448517537, :updated_at=>1448517537, :private=>true}}
|
36
|
+
[36mPerson[0m [33m10ms[0m 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
|
+
[36mPerson[0m [33m8ms[0m 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
|
+
[36mCYPHER[0m [33m21ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
39
|
+
[36mCYPHER[0m [33m17ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"032371cb-ccb1-46c7-9dc7-d1af477b23c5", :created_at=>1448517631, :updated_at=>1448517631, :private=>false}}
|
40
|
+
[36mPerson[0m [33m20ms[0m 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
|
+
[36mCYPHER[0m [33m3ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
42
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"5df502a3-dda2-446f-a0ee-52e2d4153049", :created_at=>1448517631, :updated_at=>1448517631, :private=>true}}
|
43
|
+
[36mPerson[0m [33m4ms[0m 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
|
+
[36mPerson[0m [33m5ms[0m 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
|
+
[36mCYPHER[0m [33m3ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
46
|
+
[36mCYPHER[0m [33m4ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"5f701e4c-e8a8-4dc7-8ad2-09ad43405010", :created_at=>1448517631, :updated_at=>1448517631, :private=>true}}
|
47
|
+
[36mCYPHER[0m [33m43ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"f8d0576e-9f94-4d37-8f39-3deb70f22d9b", :admin=>true}}
|
48
|
+
[36mPerson[0m [33m496ms[0m 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
|
+
[36mCYPHER[0m [33m40ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
50
|
+
[36mCYPHER[0m [33m19ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"d640e239-5200-4f7c-af71-be08748f9b1f", :created_at=>1448517826, :updated_at=>1448517826, :private=>false}}
|
51
|
+
[36mPerson[0m [33m13ms[0m 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
|
+
[36mCYPHER[0m [33m3ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
53
|
+
[36mCYPHER[0m [33m4ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"33ad26b0-5882-42db-bbf6-338ac9b76312", :created_at=>1448517826, :updated_at=>1448517826, :private=>true}}
|
54
|
+
[36mPerson[0m [33m4ms[0m 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
|
+
[36mPerson[0m [33m4ms[0m 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
|
+
[36mCYPHER[0m [33m6ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
57
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"28351a34-5148-4d94-9197-8b66f0d12bc8", :created_at=>1448517826, :updated_at=>1448517826, :private=>true}}
|
58
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"823a0ea7-d1e7-403b-8467-36fa3618911f"}}
|
59
|
+
[36mPerson[0m [33m293ms[0m 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
|
+
[36mPerson[0m [33m221ms[0m 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
|
+
[36mCYPHER[0m [33m7ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
62
|
+
[36mCYPHER[0m [33m8ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"8a22c71f-166b-4487-8ddb-ae5c409242e6", :created_at=>1448517827, :updated_at=>1448517827, :private=>true}}
|
63
|
+
[36mCYPHER[0m [33m17ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"59eaafba-0618-4c39-8ac0-c5420b01fea9", :admin=>true}}
|
64
|
+
[36mPerson[0m [33m4ms[0m 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
|
+
[36mCYPHER[0m [33m28ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
66
|
+
[36mCYPHER[0m [33m2ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
67
|
+
[36mCYPHER[0m [33m7ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"36973758-6c87-44ab-b445-ba5b70ee771f", :created_at=>1448518087, :updated_at=>1448518087, :private=>true}}
|
68
|
+
[36mPerson[0m [33m12ms[0m 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
|
+
[36mPerson[0m [33m4ms[0m 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
|
+
[36mCYPHER[0m [33m7ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
71
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"7b621fc1-1770-414d-94d3-0ba76a8597da", :created_at=>1448518087, :updated_at=>1448518087, :private=>true}}
|
72
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"ef405ac0-aa46-4bde-8ea4-d0ecdf3a8d8a"}}
|
73
|
+
[36mPerson[0m [33m487ms[0m 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
|
+
[36mPerson[0m [33m631ms[0m 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
|
+
[36mCYPHER[0m [33m7ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
76
|
+
[36mCYPHER[0m [33m7ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"d37678a6-9034-4140-8b98-65bb9fd2ffea", :created_at=>1448518088, :updated_at=>1448518088, :private=>true}}
|
77
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"c0e4c473-722b-45df-ad3c-59c9035493c6", :admin=>true}}
|
78
|
+
[36mPerson[0m [33m6ms[0m 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
|
+
[36mCYPHER[0m [33m6ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
80
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"c16202b1-f98f-4ec4-bfbc-4c13d0c0eb9e", :created_at=>1448518088, :updated_at=>1448518088, :private=>true}}
|
81
|
+
[36mCYPHER[0m [33m32ms[0m 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
|
+
[36mPerson#employer[0m [33m100ms[0m MATCH person7473 WHERE (ID(person7473) = {ID_person7473}) MATCH person7473-[rel1:`WORKS_AT`]->(result_employer:`Company`:`Asset`) DELETE rel1 | {:ID_person7473=>7473}
|
83
|
+
[36mCYPHER[0m [33m79ms[0m 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
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"d8480d03-845f-4c8a-9f2b-8292f6741bc3"}}
|
85
|
+
[36mCYPHER[0m [33m11ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
86
|
+
[36mCYPHER[0m [33m4ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"4e6f5feb-4fbd-42fa-b1ed-5718470558fd", :created_at=>1448518121, :updated_at=>1448518121, :private=>false}}
|
87
|
+
[36mPerson[0m [33m596ms[0m 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
|
+
[36mCYPHER[0m [33m3ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
89
|
+
[36mCYPHER[0m [33m4ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"739a0dc4-30e3-48a5-8b73-87ef02cf5d41", :created_at=>1448518122, :updated_at=>1448518122, :private=>true}}
|
90
|
+
[36mPerson[0m [33m3ms[0m 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
|
+
[36mPerson[0m [33m257ms[0m 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
|
+
[36mCYPHER[0m [33m7ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
93
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"c7449d03-65c6-4631-8bab-f9990c080852", :created_at=>1448518122, :updated_at=>1448518122, :private=>true}}
|
94
|
+
[36mCYPHER[0m [33m5ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"2fc3e244-e7c1-40eb-aeff-446db756753d"}}
|
95
|
+
[36mPerson[0m [33m1033ms[0m 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
|
+
[36mPerson[0m [33m347ms[0m 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
|
+
[36mCYPHER[0m [33m13ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
98
|
+
[36mCYPHER[0m [33m10ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"35f65ca1-5fdc-4d0f-b698-2a7426676ed9", :created_at=>1448518124, :updated_at=>1448518124, :private=>true}}
|
99
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"8def4d20-b8c6-459a-a1d8-b3050bef66ad", :admin=>true}}
|
100
|
+
[36mPerson[0m [33m4ms[0m 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
|
+
[36mCYPHER[0m [33m4ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
102
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"31c9051d-6033-42b6-b1b7-89023b72715f", :created_at=>1448518124, :updated_at=>1448518124, :private=>true}}
|
103
|
+
[36mCYPHER[0m [33m4ms[0m 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
|
+
[36mPerson#employer[0m [33m27ms[0m MATCH person7482 WHERE (ID(person7482) = {ID_person7482}) MATCH person7482-[rel1:`WORKS_AT`]->(result_employer:`Company`:`Asset`) DELETE rel1 | {:ID_person7482=>7482}
|
105
|
+
[36mCYPHER[0m [33m2ms[0m 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
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"22e92dcc-635e-4343-8a68-958d032d227e"}}
|
107
|
+
[36mCYPHER[0m [33m64ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
108
|
+
[36mCYPHER[0m [33m15ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"15a8f0e0-043e-4538-8ea7-f59e184e0037", :created_at=>1448518318, :updated_at=>1448518318, :private=>false}}
|
109
|
+
[36mPerson[0m [33m30ms[0m 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
|
+
[36mCYPHER[0m [33m13ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
111
|
+
[36mCYPHER[0m [33m5ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"bf714660-56d9-44a6-8ed1-6f75745cd6ac", :created_at=>1448518318, :updated_at=>1448518318, :private=>true}}
|
112
|
+
[36mPerson[0m [33m8ms[0m 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
|
+
[36mPerson[0m [33m5ms[0m 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
|
+
[36mCYPHER[0m [33m7ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
115
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"eb5bbd27-2ac0-4780-8d48-cc1817e68368", :created_at=>1448518318, :updated_at=>1448518318, :private=>true}}
|
116
|
+
[36mCYPHER[0m [33m4ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"28cd917b-1411-45e4-8241-461c31dee90e"}}
|
117
|
+
[36mPerson[0m [33m8ms[0m 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
|
+
[36mPerson[0m [33m5ms[0m 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
|
+
[36mCYPHER[0m [33m9ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
120
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"602a2838-cab7-4892-9e74-a6c4ca54134a", :created_at=>1448518318, :updated_at=>1448518318, :private=>true}}
|
121
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"918c7960-5680-4e6d-a73a-16065d3e2632", :admin=>true}}
|
122
|
+
[36mPerson[0m [33m3ms[0m 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
|
+
[36mCYPHER[0m [33m7ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
124
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"5720fbed-c28e-4359-bea0-7a946cacd404", :created_at=>1448518318, :updated_at=>1448518318, :private=>true}}
|
125
|
+
[36mCYPHER[0m [33m3ms[0m 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
|
+
[36mPerson#employer[0m [33m79ms[0m MATCH person7491 WHERE (ID(person7491) = {ID_person7491}) MATCH person7491-[rel1:`WORKS_AT`]->(result_employer:`Company`:`Asset`) DELETE rel1 | {:ID_person7491=>7491}
|
127
|
+
[36mCYPHER[0m [33m16ms[0m 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
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"e3d22a5a-5948-4efc-b14a-a1216accdee9"}}
|
129
|
+
[36mPerson[0m [33m69ms[0m 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
|
+
[36mCYPHER[0m [33m24ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
131
|
+
[36mCYPHER[0m [33m8ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"d32c27a7-d17c-4e84-b01a-c07449204de8", :created_at=>1448518384, :updated_at=>1448518384, :private=>false}}
|
132
|
+
[36mPerson[0m [33m11ms[0m 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
|
+
[36mCYPHER[0m [33m3ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
134
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"2763edea-582c-43b9-a399-ae75a912e123", :created_at=>1448518384, :updated_at=>1448518384, :private=>true}}
|
135
|
+
[36mPerson[0m [33m4ms[0m 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
|
+
[36mPerson[0m [33m3ms[0m 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
|
+
[36mCYPHER[0m [33m4ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
138
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"96542bad-ef23-42a7-a62b-c45f9f14b6fe", :created_at=>1448518384, :updated_at=>1448518384, :private=>true}}
|
139
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"6b28f557-a920-49db-a752-fc4e4951a5e5"}}
|
140
|
+
[36mPerson[0m [33m3ms[0m 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
|
+
[36mPerson[0m [33m4ms[0m 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
|
+
[36mCYPHER[0m [33m4ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
143
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"0f1e11bc-c55f-4dc6-bc56-8a2e14d09ee0", :created_at=>1448518384, :updated_at=>1448518384, :private=>true}}
|
144
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"2769afb2-ead3-4c23-96b6-66a3e45499db", :admin=>true}}
|
145
|
+
[36mPerson[0m [33m3ms[0m 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
|
+
[36mCYPHER[0m [33m4ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
147
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"12f5b73a-c1a3-4217-8ee1-62168c9bff5b", :created_at=>1448518384, :updated_at=>1448518384, :private=>true}}
|
148
|
+
[36mCYPHER[0m [33m5ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
149
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"44d17e82-34b6-42dd-a4d2-dc0fa73dc903", :created_at=>1448518385, :updated_at=>1448518385, :private=>true}}
|
150
|
+
[36mCYPHER[0m [33m2ms[0m 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
|
+
[36mPerson#employer[0m [33m43ms[0m MATCH person7501 WHERE (ID(person7501) = {ID_person7501}) MATCH person7501-[rel1:`WORKS_AT`]->(result_employer:`Company`:`Asset`) DELETE rel1 | {:ID_person7501=>7501}
|
152
|
+
[36mCYPHER[0m [33m2ms[0m 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
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"f301b0df-c6cf-48dd-9164-e2ddb10854a4"}}
|
154
|
+
[36mCYPHER[0m [33m22ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
155
|
+
[36mCYPHER[0m [33m7ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"dec39076-27f1-4575-8f54-c31a21cbfb73", :created_at=>1448518450, :updated_at=>1448518450, :private=>false}}
|
156
|
+
[36mPerson[0m [33m13ms[0m 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
|
+
[36mCYPHER[0m [33m3ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
158
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"cfc4f4e1-7061-47d9-a3ff-5d03c2ad9b32", :created_at=>1448518450, :updated_at=>1448518450, :private=>true}}
|
159
|
+
[36mPerson[0m [33m5ms[0m 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
|
+
[36mPerson[0m [33m5ms[0m 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
|
+
[36mCYPHER[0m [33m4ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
162
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"ffcbb76d-b1c2-4e14-bbc8-4e9864b1113c", :created_at=>1448518450, :updated_at=>1448518450, :private=>true}}
|
163
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"a6fb66a1-5513-4c12-9ac5-275b6af85597"}}
|
164
|
+
[36mPerson[0m [33m3ms[0m 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
|
+
[36mPerson[0m [33m5ms[0m 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
|
+
[36mCYPHER[0m [33m4ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
167
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"74377e81-3687-441d-8442-77f171aa65c7", :created_at=>1448518450, :updated_at=>1448518450, :private=>true}}
|
168
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"f8b3f880-13b3-41f9-ba2d-4dc9b5106a51", :admin=>true}}
|
169
|
+
[36mPerson[0m [33m5ms[0m 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
|
+
[36mCYPHER[0m [33m3ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
171
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"ece308e7-19cf-4d75-86e2-6761589392c6", :created_at=>1448518450, :updated_at=>1448518450, :private=>true}}
|
172
|
+
[36mPerson#allowed_users[0m [33m50ms[0m MATCH person7510 WHERE (ID(person7510) = {ID_person7510}) MATCH person7510<-[rel1:`CAN_ACCESS`]-(result_allowed_users:`User`) DELETE rel1 | {:ID_person7510=>7510}
|
173
|
+
[36mCYPHER[0m [33m9ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"75771fc0-5f78-4fe0-a591-ff6ec9c20ed5"}}
|
174
|
+
[36mPerson[0m [33m8ms[0m 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
|
+
[36mPerson[0m [33m5ms[0m 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
|
+
[36mCYPHER[0m [33m6ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
177
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"98c7fbfb-4b56-407c-a6b2-488a52e7f431", :created_at=>1448518450, :updated_at=>1448518450, :private=>true}}
|
178
|
+
[36mCYPHER[0m [33m3ms[0m 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
|
+
[36mPerson#employer[0m [33m15ms[0m MATCH person7512 WHERE (ID(person7512) = {ID_person7512}) MATCH person7512-[rel1:`WORKS_AT`]->(result_employer:`Company`:`Asset`) DELETE rel1 | {:ID_person7512=>7512}
|
180
|
+
[36mCYPHER[0m [33m2ms[0m 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
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"3a6cb0cb-f00f-43be-9934-d30a02e41d17"}}
|
182
|
+
[36mCompany#allowed_users[0m [33m9ms[0m MATCH company7513 WHERE (ID(company7513) = {ID_company7513}) MATCH company7513<-[rel1:`CAN_ACCESS`]-(result_allowed_users:`User`) DELETE rel1 | {:ID_company7513=>7513}
|
183
|
+
[36mCYPHER[0m [33m204ms[0m 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
|
+
[36mPerson[0m [33m13ms[0m 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
|
+
[36mCYPHER[0m [33m7ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
186
|
+
[36mCYPHER[0m [33m4ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"1b48ff3f-3583-41ff-a587-49db36f06e6e", :created_at=>1448518464, :updated_at=>1448518464, :private=>false}}
|
187
|
+
[36mPerson[0m [33m4ms[0m 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
|
+
[36mCYPHER[0m [33m4ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
189
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"e09ea820-30a2-4b4c-8e7b-189ac63eaa98", :created_at=>1448518464, :updated_at=>1448518464, :private=>true}}
|
190
|
+
[36mPerson[0m [33m23ms[0m 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
|
+
[36mPerson[0m [33m23ms[0m 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
|
+
[36mCYPHER[0m [33m5ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
193
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"4d6d6445-6d6b-4f2b-bbd7-c920385ca5d0", :created_at=>1448518464, :updated_at=>1448518464, :private=>true}}
|
194
|
+
[36mCYPHER[0m [33m4ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"220047fb-fa43-4f9d-b3d2-d1191bfabd57"}}
|
195
|
+
[36mPerson[0m [33m10ms[0m 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
|
+
[36mPerson[0m [33m8ms[0m 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
|
+
[36mCYPHER[0m [33m4ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
198
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"a181ba24-a546-4d90-9fe4-5e455e6ac55d", :created_at=>1448518464, :updated_at=>1448518464, :private=>true}}
|
199
|
+
[36mCYPHER[0m [33m4ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"e1d766bd-744a-4cca-8b89-914361bd3301", :admin=>true}}
|
200
|
+
[36mPerson[0m [33m3ms[0m 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
|
+
[36mCYPHER[0m [33m4ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
202
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"2a732e54-94e4-424c-9397-b58cea4452d0", :created_at=>1448518464, :updated_at=>1448518464, :private=>true}}
|
203
|
+
[36mPerson#allowed_users[0m [33m16ms[0m MATCH person7521 WHERE (ID(person7521) = {ID_person7521}) MATCH person7521<-[rel1:`CAN_ACCESS`]-(result_allowed_users:`User`) DELETE rel1 | {:ID_person7521=>7521}
|
204
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"70ba4334-3e4a-4d60-80f1-3a01d571376e"}}
|
205
|
+
[36mPerson[0m [33m3ms[0m 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
|
+
[36mPerson[0m [33m3ms[0m 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
|
+
[36mCYPHER[0m [33m6ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
208
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"4b3c310b-4499-40e6-ae1c-121b2f1fdebd", :created_at=>1448518464, :updated_at=>1448518464, :private=>true}}
|
209
|
+
[36mCYPHER[0m [33m2ms[0m 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
|
+
[36mPerson#employer[0m [33m12ms[0m MATCH person7523 WHERE (ID(person7523) = {ID_person7523}) MATCH person7523-[rel1:`WORKS_AT`]->(result_employer:`Company`:`Asset`) DELETE rel1 | {:ID_person7523=>7523}
|
211
|
+
[36mCYPHER[0m [33m2ms[0m 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
|
+
[36mCYPHER[0m [33m4ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"317daa69-cdbc-4ae3-a9b8-27c693fca38a"}}
|
213
|
+
[36mCompany#allowed_users[0m [33m12ms[0m MATCH company7524 WHERE (ID(company7524) = {ID_company7524}) MATCH company7524<-[rel1:`CAN_ACCESS`]-(result_allowed_users:`User`) DELETE rel1 | {:ID_company7524=>7524}
|
214
|
+
[36mCYPHER[0m [33m3ms[0m 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
|
+
[36mPerson[0m [33m4ms[0m 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
|
+
[36mCYPHER[0m [33m5ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
217
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"14307d0e-88b1-4de7-b4d7-a3da4798f848", :created_at=>1448518494, :updated_at=>1448518494, :private=>false}}
|
218
|
+
[36mPerson[0m [33m4ms[0m 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
|
+
[36mCYPHER[0m [33m3ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
220
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"fc294a13-e19b-486f-941e-fb5fac718ec5", :created_at=>1448518494, :updated_at=>1448518494, :private=>true}}
|
221
|
+
[36mPerson[0m [33m3ms[0m 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
|
+
[36mPerson[0m [33m5ms[0m 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
|
+
[36mCYPHER[0m [33m4ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
224
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"fe35d45e-d45f-483c-b058-9ad85a421a59", :created_at=>1448518494, :updated_at=>1448518494, :private=>true}}
|
225
|
+
[36mCYPHER[0m [33m4ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"7ec873a8-d646-4a81-a8eb-2530065ce5eb"}}
|
226
|
+
[36mPerson[0m [33m4ms[0m 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
|
+
[36mPerson[0m [33m5ms[0m 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
|
+
[36mCYPHER[0m [33m3ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
229
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"acca2995-c58e-43c7-9f1d-5d1e34fe70b8", :created_at=>1448518494, :updated_at=>1448518494, :private=>true}}
|
230
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"1bb8ccd2-c7a7-45d7-bfad-54dc4eaa5f21", :admin=>true}}
|
231
|
+
[36mPerson[0m [33m3ms[0m 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
|
+
[36mCYPHER[0m [33m4ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
233
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"0d45d2ac-c494-4913-be5a-cb3fca044abd", :created_at=>1448518494, :updated_at=>1448518494, :private=>true}}
|
234
|
+
[36mCYPHER[0m [33m3ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"16f2f70b-c5f2-4f2e-b2fe-34dd7378bc24"}}
|
235
|
+
[36mPerson#allowed_users[0m [33m12ms[0m MATCH person7532 WHERE (ID(person7532) = {ID_person7532}) MATCH person7532<-[rel1:`CAN_ACCESS`]-(result_allowed_users:`User`) DELETE rel1 | {:ID_person7532=>7532}
|
236
|
+
[36mCYPHER[0m [33m11ms[0m 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
|
+
[36mPerson[0m [33m3ms[0m 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
|
+
[36mCYPHER[0m [33m3ms[0m MATCH n OPTIONAL MATCH n-[r]-() DELETE n, r
|
239
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`Person`:`Asset` {props}) RETURN ID(n) | {:props=>{:uuid=>"413eacbf-9f48-4bdb-8c4c-5dca6f336f7a", :created_at=>1448518494, :updated_at=>1448518494, :private=>true}}
|
240
|
+
[36mCYPHER[0m [33m2ms[0m 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
|
+
[36mPerson#employer[0m [33m14ms[0m MATCH person7534 WHERE (ID(person7534) = {ID_person7534}) MATCH person7534-[rel1:`WORKS_AT`]->(result_employer:`Company`:`Asset`) DELETE rel1 | {:ID_person7534=>7534}
|
242
|
+
[36mCYPHER[0m [33m2ms[0m 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
|
+
[36mCYPHER[0m [33m2ms[0m CREATE (n:`User` {props}) RETURN ID(n) | {:props=>{:uuid=>"735b9601-e353-4df3-9449-7da588e8424f"}}
|
244
|
+
[36mCompany#allowed_users[0m [33m11ms[0m MATCH company7535 WHERE (ID(company7535) = {ID_company7535}) MATCH company7535<-[rel1:`CAN_ACCESS`]-(result_allowed_users:`User`) DELETE rel1 | {:ID_company7535=>7535}
|
245
|
+
[36mCYPHER[0m [33m2ms[0m 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
|
+
[36mPerson[0m [33m4ms[0m 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}
|