Scalr\Api\Service\User\V1beta0\Controller\Roles::modifyAction PHP Method

modifyAction() public method

Modifies role attributes
public modifyAction ( integer $roleId ) : Scalr\Api\DataType\ResultEnvelope
$roleId integer The identifier of the role
return Scalr\Api\DataType\ResultEnvelope
    public function modifyAction($roleId)
    {
        $this->checkScopedPermissions('ROLES', 'MANAGE');
        $object = $this->request->getJsonBody();
        /* @var $roleAdapter RoleAdapter */
        $roleAdapter = $this->adapter('role');
        //Pre validates the request object
        $roleAdapter->validateObject($object, Request::METHOD_PATCH);
        $role = $this->getRole($roleId, true, true);
        //Copies all alterable properties to fetched Role Entity
        $roleAdapter->copyAlterableProperties($object, $role);
        //Re-validates an Entity
        $roleAdapter->validateEntity($role);
        //Saves verified results
        $role->save();
        return $this->result($roleAdapter->toData($role));
    }