src/extensions/SiteConfigMediaPermissionExtension.php
public function updateCMSFields(FieldList $fields) {

		$permissions = array(
			'ADMIN' => 'Administrators and developers',
			'SITETREE_EDIT_ALL' => 'Content authors'
		);

		// Confirm that the current CMS user has permission.

		if(Permission::check('EDIT_SITECONFIG') === false) {
			$fields->addFieldToTab('Root.Access', $options = ReadonlyField::create(
				'Media',
				'Who can customise media?',
				$permissions[$this->owner->MediaPermission]
			));
		}
		else {

			// Display the permission configuration.

			$fields->addFieldToTab('Root.Access', $options = OptionsetField::create(
				'MediaPermission',
				'Who can customise media?',
				$permissions
			));
		}

		// Allow extension customisation.

		$this->owner->extend('updateSiteConfigMediaPermissionExtensionCMSFields', $fields);
	}
public function updateCMSFields(FieldList $fields) {

		$permissions = array(
			'ADMIN' => 'Administrators and developers',
			'SITETREE_EDIT_ALL' => 'Content authors'
		);

		// Confirm that the current CMS user has permission.

		if(Permission::check('EDIT_SITECONFIG') === false) {
			$fields->addFieldToTab('Root.Access', $options = ReadonlyField::create(
				'Media',
				'Who can customise media?',
				$permissions[$this->owner->MediaPermission]
			));
		}
		else {

			// Display the permission configuration.

			$fields->addFieldToTab('Root.Access', $options = OptionsetField::create(
				'MediaPermission',
				'Who can customise media?',
				$permissions
			));
		}

		// Allow extension customisation.

		$this->owner->extend('updateSiteConfigMediaPermissionExtensionCMSFields', $fields);
	}
public function updateCMSFields ( FieldList $ fields ) { $ permissions = array ( 'ADMIN' => 'Administrators and developers' , 'SITETREE_EDIT_ALL' => 'Content authors' ) ; // Confirm that the current CMS user has permission. if ( Permission :: check ( 'EDIT_SITECONFIG' ) === false ) { $ fields -> addFieldToTab ( 'Root.Access' , $ options = ReadonlyField :: create ( 'Media' , 'Who can customise media?' , $ permissions [ $ this -> owner -> MediaPermission ] ) ) ; } else { // Display the permission configuration. $ fields -> addFieldToTab ( 'Root.Access' , $ options = OptionsetField :: create ( 'MediaPermission' , 'Who can customise media?' , $ permissions ) ) ; } // Allow extension customisation. $ this -> owner -> extend ( 'updateSiteConfigMediaPermissionExtensionCMSFields' , $ fields ) ; }
Allow permission configuration for customisation of media.
Allow permission configuration for customisation of media .