Skip to content

Commit

Permalink
Merge pull request #71 from cernbox/cernbox-prod-8.2.2-eos-oc-permiss…
Browse files Browse the repository at this point in the history
…ion-map-for-public-links

Give full permission to shares by link guests
  • Loading branch information
NadirRoGue authored Aug 31, 2016
2 parents e730921 + 57881dc commit 02352b3
Showing 1 changed file with 29 additions and 23 deletions.
52 changes: 29 additions & 23 deletions lib/private/files/objectstore/eosparser.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,44 +88,50 @@ public static function parseFileInfoMonitorMode($line_to_parse) {
}

$currentUser = \OC_User::getUser();
$linkShare = false;
if(!$currentUser)
{
$currentUser = EosUtil::isSharedLinkGuest();
$linkShare = true;
$data['permissions'] = 31;
}

$groups = \OC\LDAPCache\LDAPCacheManager::getUserEGroups($currentUser);
$ocPerm = EosUtil::toOcAcl($data['sys.acl']);

$isInACL = false;
$aclMember = '';
if(isset($ocPerm[$currentUser]))
if(!$linkShare)
{
$isInACL = true;
$aclMember = $currentUser;
}
else
{
$highestOcPerm = 0;
foreach($groups as $group)
$isInACL = false;
$aclMember = '';
if(isset($ocPerm[$currentUser]))
{
if(isset($ocPerm[$group]) && $ocPerm[$group]['ocperm'] > $highestOcPerm)
$isInACL = true;
$aclMember = $currentUser;
}
else
{
$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;
$permissions = $ocPerm[$aclMember]['ocperm'];
if(EosUtil::getOwner($data['eospath']) === $aclMember) //is the owner, so give share permissions
{
$permissions = 31;
}

$data['permissions'] = $permissions;
}

$data['permissions'] = $permissions;
}

if($indexSysOwnerAuth !== -1) {
Expand Down

0 comments on commit 02352b3

Please sign in to comment.