protected function checkOwnerPerms(DataObject $node, $perm, $member)
    {
        $ownerId = $node->OwnerID;
        if (!$node) {
            return;
        }

        if ($node->isChanged('OwnerID')) {
            $changed = $node->getChangedFields();
            $ownerId = isset($changed['OwnerID']['before']) && $changed['OwnerID']['before'] ? $changed['OwnerID']['before'] : $ownerId;
        }
        if (!$member || ($ownerId != $member->ID)) {
            return false;
        }

        $cache = $this->getCache();

        $perms = $cache->load('ownerperms');
        if (!$perms) {
            // find the owner role and take the permissions of it 
            $ownerRole = DataObject::get_one('AccessRole', '"Title" = \'Owner\'');
            if ($ownerRole && $ownerRole->exists()) {
                $perms = $ownerRole->Composes->getValues();
                if (is_array($perms)) {
                    $cache->save($perms, 'ownerperms');
                }
            } else {
                // just fall back to checking OwnerID == $member->ID
                return $ownerId == $member->ID;
            }
        }

        if (is_array($perms) && in_array($perm, $perms)) {
            return true;
        }
    }
protected function checkOwnerPerms(DataObject $node, $perm, $member)
    {
        $ownerId = $node->OwnerID;
        if (!$node) {
            return;
        }

        if ($node->isChanged('OwnerID')) {
            $changed = $node->getChangedFields();
            $ownerId = isset($changed['OwnerID']['before']) && $changed['OwnerID']['before'] ? $changed['OwnerID']['before'] : $ownerId;
        }
        if (!$member || ($ownerId != $member->ID)) {
            return false;
        }

        $cache = $this->getCache();

        $perms = $cache->load('ownerperms');
        if (!$perms) {
            // find the owner role and take the permissions of it 
            $ownerRole = DataObject::get_one('AccessRole', '"Title" = \'Owner\'');
            if ($ownerRole && $ownerRole->exists()) {
                $perms = $ownerRole->Composes->getValues();
                if (is_array($perms)) {
                    $cache->save($perms, 'ownerperms');
                }
            } else {
                // just fall back to checking OwnerID == $member->ID
                return $ownerId == $member->ID;
            }
        }

        if (is_array($perms) && in_array($perm, $perms)) {
            return true;
        }
    }
protected function checkOwnerPerms ( DataObject $ node , $ perm , $ member ) { $ ownerId = $ node -> OwnerID ; if ( ! $ node ) { return ; } if ( $ node -> isChanged ( 'OwnerID' ) ) { $ changed = $ node -> getChangedFields ( ) ; $ ownerId = isset ( $ changed [ 'OwnerID' ] [ 'before' ] ) && $ changed [ 'OwnerID' ] [ 'before' ] ? $ changed [ 'OwnerID' ] [ 'before' ] : $ ownerId ; } if ( ! $ member || ( $ ownerId != $ member -> ID ) ) { return false ; } $ cache = $ this -> getCache ( ) ; $ perms = $ cache -> load ( 'ownerperms' ) ; if ( ! $ perms ) { // find the owner role and take the permissions of it  $ ownerRole = DataObject :: get_one ( 'AccessRole' , '"Title" = \'Owner\'' ) ; if ( $ ownerRole && $ ownerRole -> exists ( ) ) { $ perms = $ ownerRole -> Composes -> getValues ( ) ; if ( is_array ( $ perms ) ) { $ cache -> save ( $ perms , 'ownerperms' ) ; } } else { // just fall back to checking OwnerID == $member->ID return $ ownerId == $ member -> ID ; } } if ( is_array ( $ perms ) && in_array ( $ perm , $ perms ) ) { return true ; } }
Is the member the owner of this object, and is the permission being checked
in the list of permissions that owners have?

@param string $perm
@param Member $member
@return boolean
Is the member the owner of this object and is the permission being checked in the list of permissions that owners have?