Source of file FileDefaultPermissions.php

Size: 1,126 Bytes - Last Modified: 2018-05-22T11:41:18+00:00

/var/www/docs.ssmods.com/process/src/src/FileDefaultPermissions.php

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
<?php

namespace SilverStripe\Assets;

use SilverStripe\Security\Member;
use SilverStripe\Security\Permission;
use SilverStripe\Security\DefaultPermissionChecker;

/**
 * Permissions for root files with Can*Type = Inherit
 */
class FileDefaultPermissions implements DefaultPermissionChecker
{
    /**
     * Can root be edited?
     *
     * @param Member $member
     * @return bool
     */
    public function canEdit(Member $member = null)
    {
        return Permission::checkMember($member, File::EDIT_ALL);
    }

    /**
     * Can root be viewed?
     *
     * @param Member $member
     * @return bool
     */
    public function canView(Member $member = null)
    {
        return true;
    }

    /**
     * Can root be deleted?
     *
     * @param Member $member
     * @return bool
     */
    public function canDelete(Member $member = null)
    {
        return $this->canEdit($member);
    }

    /**
     * Can root objects be created?
     *
     * @param Member $member
     * @return bool
     */
    public function canCreate(Member $member = null)
    {
        return $this->canEdit($member);
    }
}