src/Api/Controller/Bucket.php
public function postIndex()
    {
        $oInput     = Factory::service('Input');
        $oHttpCodes = Factory::service('HttpCodes');

        if (!userHasPermission('admin:cdn:manager:bucket:create')) {
            throw new ApiException(
                'You do not have permission to create this resource',
                $oHttpCodes::STATUS_UNAUTHORIZED
            );
        }

        //  @todo (Pablo - 2018-08-16) - Remove once CrudController validates properly itself
        if (!$oInput->post('label')) {
            throw new ApiException(
                '`label` is a required field',
                $oHttpCodes::STATUS_UNAUTHORIZED
            );
        }

        return parent::postIndex();
    }
public function postIndex()
    {
        $oInput     = Factory::service('Input');
        $oHttpCodes = Factory::service('HttpCodes');

        if (!userHasPermission('admin:cdn:manager:bucket:create')) {
            throw new ApiException(
                'You do not have permission to create this resource',
                $oHttpCodes::STATUS_UNAUTHORIZED
            );
        }

        //  @todo (Pablo - 2018-08-16) - Remove once CrudController validates properly itself
        if (!$oInput->post('label')) {
            throw new ApiException(
                '`label` is a required field',
                $oHttpCodes::STATUS_UNAUTHORIZED
            );
        }

        return parent::postIndex();
    }
public function postIndex ( ) { $ oInput = Factory :: service ( 'Input' ) ; $ oHttpCodes = Factory :: service ( 'HttpCodes' ) ; if ( ! userHasPermission ( 'admin:cdn:manager:bucket:create' ) ) { throw new ApiException ( 'You do not have permission to create this resource' , $ oHttpCodes :: STATUS_UNAUTHORIZED ) ; } //  @todo (Pablo - 2018-08-16) - Remove once CrudController validates properly itself if ( ! $ oInput -> post ( 'label' ) ) { throw new ApiException ( '`label` is a required field' , $ oHttpCodes :: STATUS_UNAUTHORIZED ) ; } return parent :: postIndex ( ) ; }
Overridden to check user permissions before creating buckets

@return array
Overridden to check user permissions before creating buckets