Updates a scope. If the scope does not exists, returns an error.

@param req http request
@return String message that will be returned in the response
559645
public String updateScope(FullHttpRequest req, String scopeName) throws OAuthException {
        String contentType = (req.headers() != null) ? req.headers().get(HttpHeaderNames.CONTENT_TYPE) : null;
        // check Content-Type
        if (contentType != null && contentType.contains(ResponseBuilder.APPLICATION_JSON)) {
            try {
                Scope scope = InputValidator.validate(req.content().toString(CharsetUtil.UTF_8), Scope.class);
                if (scope.validForUpdate()) {
                    Scope foundScope = DBManagerFactory.getInstance().findScope(scopeName).blockingGet();
                    if (foundScope == null) {
                        LOG.error("scope does not exist");
                        throw new OAuthException(SCOPE_NOT_EXIST, HttpResponseStatus.BAD_REQUEST);
                    } else {
                        setScopeEmptyValues(scope, foundScope);
                        DBManagerFactory.getInstance().storeScope(scope);
                    }
                } else {
                    LOG.error("scope is not valid");
                    throw new OAuthException(MANDATORY_SCOPE_ERROR, HttpResponseStatus.BAD_REQUEST);
                }
            } catch (Exception e) {
                LOG.error("cannot handle scope request", e);
                throw new OAuthException(e, null, HttpResponseStatus.BAD_REQUEST);
            }
        } else {
            throw new OAuthException(ResponseBuilder.UNSUPPORTED_MEDIA_TYPE, HttpResponseStatus.BAD_REQUEST);
        }
        return SCOPE_UPDATED_OK_MESSAGE;
    }
1226208
@Nonnull
  public static IRequestWebScope onRequestBegin (@Nonnull final HttpServletRequest aHttpRequest,
                                                 @Nonnull final HttpServletResponse aHttpResponse)
  {
    return onRequestBegin (aHttpRequest, aHttpResponse, RequestWebScopeMultipart::new);
  }
1295072
public function update($id, UpdateRequest $request)
	{		
		$level = "danger";
		$message = " You are not permitted to update roles.";

		if ( Shinobi::can ( config('watchtower.acl.role.edit', false) ) ) {
			$role = Role::findOrFail($id);
			$role->update($request->all());
			$level = "success";
			$message = "<i class='fa fa-check-square-o fa-1x'></i> Success! Role edited.";
		}

		return redirect()->route( config('watchtower.route.as') .'role.index')
				->with( ['flash' => ['message' => $message, 'level' =>  $level] ] );
	}
144952
public function updateAction(Request $request): Response
    {
        $form = $this->formFactory->updateLocation();
        $form->handleRequest($request);

        $location = $form->getData()->getLocation();

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (LocationUpdateData $data) {
                $location = $data->getLocation();

                $locationUpdateStruct = new LocationUpdateStruct(['sortField' => $data->getSortField(), 'sortOrder' => $data->getSortOrder()]);
                $this->locationService->updateLocation($location, $locationUpdateStruct);

                $this->notificationHandler->success(
                    $this->translator->trans(
                        /** @Desc("Location '%name%' updated.") */
                        'location.update.success',
                        ['%name%' => $location->getContentInfo()->name],
                        'location'
                    )
                );

                return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
                        'locationId' => $location->getContentInfo()->mainLocationId,
                        '_fragment' => DetailsTab::URI_FRAGMENT,
                    ]));
            });

            if ($result instanceof Response) {
                return $result;
            }
        }

        return $this->redirect($this->generateUrl('_ezpublishLocation', [
            'locationId' => $location->getContentInfo()->mainLocationId,
            '_fragment' => DetailsTab::URI_FRAGMENT,
        ]));
    }
186362
public function update(Request $request)
    {
        $package = $request->query->get('package');

        try {
            $response = $this->app['extend.manager']->updatePackage((array) $package);
        } catch (\Exception $e) {
            return $this->getJsonException($e);
        }

        if ($response === 0) {
            $this->app['logger.system']->info("Updated $package", ['event' => 'extensions']);

            return $this->json($this->manager()->getOutput());
        }

        return $this->getJsonException(new PackageManagerException($this->manager()->getOutput(), $response));
    }
621666
public function update(FaqRequest $request, Faq $faq)
    {
        try {
            $attributes = $request->all();

            $faq->update($attributes);
            return $this->response->message(trans('messages.success.updated', ['Module' => trans('faq::faq.name')]))
                ->code(204)
                ->status('success')
                ->url(guard_url('faq/faq/' . $faq->getRouteKey()))
                ->redirect();
        } catch (Exception $e) {
            return $this->response->message($e->getMessage())
                ->code(400)
                ->status('error')
                ->url(guard_url('faq/faq/' . $faq->getRouteKey()))
                ->redirect();
        }

    }
247970
public function update(Request $request)
    {
        if ($request->has('notification')) {
            foreach ($request->notification as $id => $severity) {
                if (in_array(strtolower($severity), ['low', 'medium', 'high', 'disabled'])) {
                    Severity::where('id', $id)->update(['severity' => strtolower($severity)]);
                }
            }
        }

        return redirect(route('eyewitness.settings.index').'#severity')->withSuccess('The notification severity settings have been updated.');
    }
99945
public Observable<ServiceResponse<ManagementLockObjectInner>> getByScopeWithServiceResponseAsync(String scope, String lockName) {
        if (scope == null) {
            throw new IllegalArgumentException("Parameter scope is required and cannot be null.");
        }
        if (lockName == null) {
            throw new IllegalArgumentException("Parameter lockName is required and cannot be null.");
        }
        if (this.client.apiVersion() == null) {
            throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
        }
        return service.getByScope(scope, lockName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ManagementLockObjectInner>>>() {
                @Override
                public Observable<ServiceResponse<ManagementLockObjectInner>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<ManagementLockObjectInner> clientResponse = getByScopeDelegate(response);
                        return Observable.just(clientResponse);
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }
312393
public static Object getScopedRequestAttribute( String attrName, ServletRequest request )
    {
        if ( request instanceof ScopedRequest )
        {
            return ( ( ScopedRequest ) request ).getAttribute( attrName, false );
        }
        
        return request.getAttribute( attrName );
    }
1139400
public function handle($request, Closure $next, ...$requestedScopes)
    {
        if (! $this->token->exists()) {
            return $next($request);
        }

        $providedScopes = $this->token->scopes;

        // If any of the requested scopes were not provided, throw an exception.
        $missingScopes = array_diff($requestedScopes, $providedScopes);
        if (count($missingScopes)) {
            $message = 'Requires a token with the following scopes: '.implode(', ', $missingScopes);
            throw new AccessDeniedHttpException($message);
        }

        return $next($request);
    }
957314
def request_param_update(self, var_id):
        """"""
        self._useV2 = self.cf.platform.get_protocol_version() >= 4
        pk = CRTPPacket()
        pk.set_header(CRTPPort.PARAM, READ_CHANNEL)
        if self._useV2:
            pk.data = struct.pack('<H', var_id)
        else:
            pk.data = struct.pack('<B', var_id)
        logger.debug('Requesting request to update param [%d]', var_id)
        self.request_queue.put(pk)
566479
def check_scope(scope = nil)
      # If no scope is requested or the change has no scope include this change unchanged
      return self unless scope
      change_scope = /^\s*\[\w+\]/.match(@note)
      return self unless change_scope

      # change_scope is a string of format `[scope]`, need to strip the `[]` to compare the scope
      if change_scope[0][1..-2] == scope
        #  Change has the scope that is requested, strip the whole scope scope from the change note
        @note = change_scope.post_match.strip
        return self
      else
        #  Change has a different scope than requested
        return nil
      end
    end
987817
def querystring_update(request, **kwargs):
    
    updated = request.GET.copy()
    for k, v in kwargs.items():
        updated[k] = v

    return updated.urlencode()
567116
public function scopeRequestWhere($query, Request $request)
    {
        if ($request->has('where')) {
            $query->where($request->input('where'));
        }

        return $query;
    }
408291
function (unused, req) {
            var res = req.res, cb = req.callback;
            if (!cb) {
                this.$logError(this.MISSING_IO_CALLBACK, [res.url]);
            } else if (res.error != null) {
                // an error occured
                // call the error callback
                if (cb.onerror == null) {
                    // Generic IO error mgt
                    this.$logError(this.IO_REQUEST_FAILED, [res.url, res.error]);
                } else {
                    var scope = cb.onerrorScope;
                    if (!scope) {
                        scope = cb.scope;
                    }
                    try {
                        cb.onerror.call(scope, res, cb.args);
                    } catch (ex) {
                        this.$logError(this.IO_CALLBACK_ERROR, [res.url], ex);
                    }
                }
            } else {

                // check the response type to adapt it to the request
                if (req.expectedResponseType) {

                    this._jsonTextConverter(res, req.expectedResponseType);
                }

                cb.fn.call(cb.scope, res, cb.args);
            }
            req = cb = null;
        }
701154
public function scopeExists($scope, $client_id = null)
    {
        $scopes = explode(' ', $scope);
        if ($client_id) {
            // Get Client
            $client = $this->em->getRepository('OAuth2ServerBundle:Client')->find($client_id);

            if (!$client) {
                return false;
            }

            $valid_scopes = $client->getScopes();

            foreach ($scopes as $scope) {
                if (!in_array($scope, $valid_scopes)) {
                    return false;
                }
            }

            return true;
        }

        $valid_scopes = $this->sm->findScopesByScopes($scopes);

        return count($valid_scopes) == count($scopes);
    }
1081374
protected void doRequest(javax.servlet.sip.SipServletRequest req) throws javax.servlet.ServletException, java.io.IOException{
    	String m = req.getMethod();
		if ("INVITE".equals(m))
			doInvite(req);
		else if ("ACK".equals(m))
			doAck(req);
		else if ("OPTIONS".equals(m))
			doOptions(req);
		else if ("BYE".equals(m))
			doBye(req);
		else if ("CANCEL".equals(m))
			doCancel(req);
		else if ("REGISTER".equals(m))
			doRegister(req);
		else if ("SUBSCRIBE".equals(m))
			doSubscribe(req);
		else if ("NOTIFY".equals(m))
			doNotify(req);
		else if ("MESSAGE".equals(m))
			doMessage(req);
		else if ("INFO".equals(m))
			doInfo(req);
		else if ("REFER".equals(m))
			doRefer(req);
		else if ("PUBLISH".equals(m))
			doPublish(req);
		else if ("UPDATE".equals(m))
			doUpdate(req);
		else if ("PRACK".equals(m))
			doPrack(req);
		else if (req.isInitial())
			notHandled(req);
    }