Neo4j – Alles Rechte und Gruppenmitgliedschaften einer Abteilung

Über das Department werden die Mitglieder und dann alle damit verbundenen Gruppen gezogen

 

MATCH (m:ADAccount) where m.type="person" and m.department ="A-4241" 
MATCH (n:ADAccount) where n.type="person" and n.department ="A-4241" 
with n as u, count(n) as A_Member MATCH p=(u)<-[:rel_member*..]-(g) 
where g.type="group" and not g.domain="local" with u, g, count(g) as 
A_Gruppen, A_Member RETURN distinct count (g) as Memberships,A_Member, 
g.name, u.department order by g.name

 

 

Memberships A_Member g.name u.department
6 1 alle el-user A-4241
3 1 alle pps-user A-4241
6 1 alle_elundbi2-user A-4241
6 1 alle_sfbuser_el A-4241
6 1 allepfuserlinz A-4241
6 1 anlagen-archive-read A-4241
1 1 anlagen-cadcam-change A-4241
6 1 anlagen-read A-4241

 

 

 

 

—————

Abfrage über alle Abteilungen

Hier muss noch für jede Abteilung die effektive Anzahl der Mitglieder abgefragt werden. Weil es sonst zu umständlich wäre. Es muss einen Index für Department geben.

 

MATCH (u:ADAccount) where u.type="person" and not u.department ="" 
with distinct u.department as department, count(u) as Member MATCH 
(u:ADAccount)<-[:rel_member*..]-(g:ADAccount) where u.department = 
department and g.type="group" and not g.domain="local" and not g.grouptype=
"BuiltIn_Group" and not g.grouptype="Local_Distribution_Group" and not g.grouptype
="Universal_Distribution_Group" and not g.grouptype="Global_Distribution_Group" with 
u, g, count(g) as A_Gruppen,Member RETURN distinct count (g) as Memberships, g.name, 
u.department, Member order by Member desc, u.department,Memberships desc, g.name

 

 

Memberships Member g.name u.department
2 2 alle el-user 1-0
2 2 alle pps-user 1-0
2 2 alle_sfbuser_el 1-0
2 2 allepfuserlinz 1-0
2 2 applsql-activedirectory-readall 1-0
2 2 applsql-adressen-read 1-0
2 2 applsql-esm-changeall 1-0
2 2 applsql-esm-readall 1-0
2 2 applsql-excel-as400export 1-0
2 2 applsql-systemverwaltung-readall 1-0
2 2 applsql-tdvchecklist-protectdrive-change 1-0
2 2 applsql-wordstat-changeall 1-0

Permanentlink zu diesem Beitrag: https://help.migraven.com/neo4j-alles-rechte-und-gruppenmitgliedschaften-einer-abteilung/