diff --git a/lib/private/files/objectstore/eosparser.php b/lib/private/files/objectstore/eosparser.php index d283dec38bf9..6ab230c498fb 100644 --- a/lib/private/files/objectstore/eosparser.php +++ b/lib/private/files/objectstore/eosparser.php @@ -96,41 +96,58 @@ public static function parseFileInfoMonitorMode($line_to_parse) { $data['permissions'] = 31; } - $groups = \OC\LDAPCache\LDAPCacheManager::getUserEGroups($currentUser); - $ocPerm = EosUtil::toOcAcl($data['sys.acl']); - if(!$linkShare) { - $isInACL = false; - $aclMember = ''; - if(isset($ocPerm[$currentUser])) + $isOwner = EosUtil::getOwner($data['eospath']) === $currentUser; + if($data['eostype'] === 'file' || strpos($data['eospath'], '.sys.v#') !== FALSE) //Files and sys folder { - $isInACL = true; - $aclMember = $currentUser; + if($isOwner) + { + $data['permissions'] = 31; // Read + write + share + } + else + { + $data['permissions'] = 15; // Read + write + } } - else + else // Folders { - $highestOcPerm = 0; - foreach($groups as $group) + $groups = \OC\LDAPCache\LDAPCacheManager::getUserEGroups($currentUser); + $ocPerm = EosUtil::toOcAcl($data['sys.acl']); + + $isInACL = false; + $aclMember = ''; + if(isset($ocPerm[$currentUser])) + { + $isInACL = true; + $aclMember = $currentUser; + } + else { - if(isset($ocPerm[$group]) && $ocPerm[$group]['ocperm'] > $highestOcPerm) + $highestOcPerm = 0; + foreach($groups as $group) { - $isInACL = true; - $aclMember = $group; - $highestOcPerm = $ocPerm[$group]['ocperm']; + if(isset($ocPerm[$group]) && $ocPerm[$group]['ocperm'] > $highestOcPerm) + { + $isInACL = true; + $aclMember = $group; + $highestOcPerm = $ocPerm[$group]['ocperm']; + } } } - } - - if($isInACL) - { - $permissions = $ocPerm[$aclMember]['ocperm']; - if(EosUtil::getOwner($data['eospath']) === $aclMember) //is the owner, so give share permissions + + if($isInACL) { - $permissions = 31; + if($isOwner) //is the owner, so give share permissions + { + $permissions = 31; + } + else + { + $permissions = $ocPerm[$aclMember]['ocperm']; + } + $data['permissions'] = $permissions; } - - $data['permissions'] = $permissions; } }