File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -148,8 +148,32 @@ private function getUserGrants($resourcePath, $webId) {
148148
149149 // error_log("GET GRANTS for $webId");
150150
151+ // Start with grants that everyone has
151152 $ grants = $ this ->getPublicGrants ($ resourcePath );
153+
154+ // Then get grants that are valid for any authenticated agent;
155+ $ foafAgent = "http://xmlns.com/foaf/0.1/AuthenticatedAgent " ;
156+ $ matching = $ graph ->resourcesMatching ('http://www.w3.org/ns/auth/acl#agentClass ' );
157+ foreach ($ matching as $ match ) {
158+ $ agentClass = $ match ->get ("<http://www.w3.org/ns/auth/acl#agentClass> " );
159+ if ($ agentClass == $ foafAgent ) {
160+ $ accessTo = $ match ->get ("<http://www.w3.org/ns/auth/acl#accessTo> " );
161+ $ default = $ match ->get ("<http://www.w3.org/ns/auth/acl#default> " );
162+ $ modes = $ match ->all ("<http://www.w3.org/ns/auth/acl#mode> " );
163+ if ($ default ) {
164+ foreach ($ modes as $ mode ) {
165+ $ grants ["default " ][$ mode ->getUri ()] = $ default ->getUri ();
166+ }
167+ }
168+ if ($ accessTo ) {
169+ foreach ($ modes as $ mode ) {
170+ $ grants ["accessTo " ][$ mode ->getUri ()] = $ accessTo ->getUri ();
171+ }
172+ }
173+ }
174+ }
152175
176+ // Then add grants for this specific user;
153177 $ matching = $ graph ->resourcesMatching ('http://www.w3.org/ns/auth/acl#agent ' );
154178 //error_log("MATCHING " . sizeof($matching));
155179 // Find all grants machting our webId;
You can’t perform that action at this time.
0 commit comments