Handles removing object state groups based on submitted form.

@param \Symfony\Component\HttpFoundation\Request $request
@param int $objectStateGroupId

@return \Symfony\Component\HttpFoundation\Response
10083
public function bulkDeleteAction(Request $request, int $objectStateGroupId): Response
    {
        $this->denyAccessUnlessGranted(new Attribute('state', 'administrate'));
        $form = $this->formFactory->create(
            ObjectStatesDeleteType::class,
            new ObjectStatesDeleteData()
        );
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (ObjectStatesDeleteData $data) {
                foreach ($data->getObjectStates() as $objectStateId => $selected) {
                    $objectState = $this->objectStateService->loadObjectState($objectStateId);
                    $this->objectStateService->deleteObjectState($objectState);

                    $this->notificationHandler->success(
                        $this->translator->trans(
                            /** @Desc("Object state '%name%' deleted.") */
                            'object_state.delete.success',
                            ['%name%' => $objectState->getName()],
                            'object_state'
                        )
                    );
                }
            });

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

        return $this->redirectToRoute('ezplatform.object_state.group.view', [
            'objectStateGroupId' => $objectStateGroupId,
        ]);
    }
1243075
public function deleteObjectState($objectStateId)
    {
        $this->objectStateService->deleteObjectState(
            $this->objectStateService->loadObjectState($objectStateId)
        );

        return new Values\NoContent();
    }
1059635
public function createGroupAsync(CreateGroupRequest $request, AsyncCallback $callback = null)
    {
        $response = new CreateGroupResponse();
        return $this->client->sendRequestAsync($request, $response, $callback);
    }
393662
public void deleteRequestGroup(String requestGroupId) {
    final Function<String, String> requestUri = (host) -> String.format(REQUEST_GROUP_FORMAT, getApiBase(host), requestGroupId);

    delete(requestUri, "request group", requestGroupId);
  }
1061324
def delete_group_action(model, request):
    
    try:
        groups = model.parent.backend
        uid = model.model.name
        del groups[uid]
        groups()
        model.parent.invalidate()
    except Exception as e:
        return {
            'success': False,
            'message': str(e)
        }
    localizer = get_localizer(request)
    message = localizer.translate(_(
        'deleted_group',
        default='Deleted group from database'
    ))
    return {
        'success': True,
        'message': message
    }
877061
public function deleteGroupsAction(Request $request)
    {
        $format = $request->get('_format', 'json');
        $facade = $this->get('jms_serializer')->deserialize(
            $request->getContent(),
            $this->getParameter('open_orchestra_group.facade.group_collection.class'),
            $format
        );
        $groupRepository = $this->get('open_orchestra_user.repository.group');
        $groups = $this->get('open_orchestra_api.transformer_manager')->reverseTransform('group_collection', $facade);

        $filter = $groups;
        array_walk($filter, function(&$item) {$item = $item->getId();});
        $nbrGroupsUsers = $this->get('open_orchestra_user.repository.user')->getCountsUsersByGroups($filter);
        $groupIds = array();
        foreach ($groups as $group) {
            if ($this->isGranted(ContributionActionInterface::DELETE, $group) &&
                $this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(BusinessActionInterface::DELETE, $group, $nbrGroupsUsers)
            ) {
                $groupIds[] = $group->getId();
                $this->dispatchEvent(GroupEvents::GROUP_DELETE, new GroupEvent($group));
            }
        }

        $groupRepository->removeGroups($groupIds);

        return array();
    }
1200813
public function removeRolesAction($id, $class, Request $request)
    {
        $object = $this->find($class, $id);
        $roles = $this->decodeIdsString($request, 'Claroline\CoreBundle\Entity\Role');
        $this->crud->patch($object, 'role', Crud::COLLECTION_REMOVE, $roles);

        return new JsonResponse(
          $this->serializer->serialize($object)
      );
    }
333193
public function removeGroupFromRole(int $group_id, int $role_id)
    {

        $role = $this->getRole($role_id);
        if ($role->groups()->detach($group_id) > 0)
            event(new UserGroupRoleRemoved($group_id, $role));

    }
1041561
public function sortingGroup(Request $request){

        $model  = new \App\Droit\Arret\Entities\Groupe();
        $helper = new Helper();
        $data = $request->all();

        $groupe_rang = $data['groupe_rang'];
        $groupe_id   = $data['groupe_id'];

        $arrets = $helper->prepareCategories($groupe_rang);

        $groupe = $model->find($groupe_id);
        $groupe->arrets()->sync($arrets);

        print_r($groupe);

    }
398416
public function init(Request $request, $group)
	{
		// Lets validate if the post type exists and if so, continue.
		$postTypeModel = $this->getPostType($group);
		if(!$postTypeModel){
    		$errorMessages = 'You are not authorized to do this.';
    		return $this->abort($errorMessages);
    	}

		// Recieving the values
		$configMeta = $request->all();

		// Unsetting values which we do not need
		$unsetValues = ['_token'];
		foreach($unsetValues as $value){
			unset($configMeta[$value]);
		}

		// Receiving validation rules from config
		$validationRules = [];
		foreach ($configMeta as $key => $value) {

			// Setting the path to get the validation rules
			if(strpos($key, '_repeater_') !== false) {
				$explodedValue = explode('_', $key);

				// Removing the old repeater values so we can resave them all, if we do
				// not do this, it will keep having the old values in the database.
				NikuConfig::where([
					['option_name', 'like', $explodedValue[0] . '_' . $explodedValue[1] . '_%'],
					['group', '=', $group]
				])->delete();

				// For each all groups to get the validation
				foreach($postTypeModel->view as $templateKey => $template){
					if(array_has($template, 'customFields.' . $explodedValue[0] . '.customFields.' . $explodedValue[3] . '.validation')){
						$rule = $template['customFields'][$explodedValue[0]]['customFields'][$explodedValue[3]]['validation'];
					}
				}

			} else {

				// For each all groups to get the validation
				foreach($postTypeModel->view as $templateKey => $template){
					if(array_has($template, 'customFields.' . $key . '.validation')){
						$rule = $template['customFields'][$key]['validation'];
					}
				}

			}

			// Appending the validation rules to the validation array
			if(!empty($rule)){
				$validationRules[$key] = $rule;
			}

		}

		// Validate the request
		if(!empty($validationRules)){
			$this->validatePost($request, $validationRules);
		}

		// Lets update or create the fields in the post request
		foreach($configMeta as $index => $value){

			NikuConfig::updateOrCreate(
				['option_name' => $index],
				[
					'option_value' => $value,
					'group' => $group
				]
			);
		}

		$successMessage = 'Config succesfully updated.';
		if(array_has($postTypeModel->successMessage, 'config_updated')){
			$successMessage = $postTypeModel->successMessage['config_updated'];
		}

		// Lets return the response
    	return response()->json([
    		'code' => 'success',
    		'message' => $successMessage,
    		'action' => 'config_updated',
		], 200);
	}
938279
public function destroy(Request $request, $id)
    {
        // Fetch the role object
        // $id = $this->decode($hash);
        $role = $this->roleRepository->findById($id);

        // Prevent the deletion of roles have the current user as a member
        if (Sentinel::inRole($role)) {
            if ($request->expectsJson()) {
                return response()->json("You must leave this group before it can be removed.", 422);
            }
            session()->flash('error', "You must leave this group before it can be removed.");
            return redirect()->back()->withInput();
        }

        // Remove the role
        $role->delete();

        // All done
        $message = "Role '{$role->name}' has been removed.";
        if ($request->expectsJson()) {
            return response()->json([$message], 200);
        }

        session()->flash('success', $message);
        return redirect()->route('roles.index');
    }
223101
public function updateAction(Request $request, ObjectStateGroup $group): Response
    {
        $this->denyAccessUnlessGranted(new Attribute('state', 'administrate'));
        $form = $this->formFactory->updateObjectStateGroup(
            new ObjectStateGroupUpdateData($group)
        );
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (ObjectStateGroupUpdateData $data) {
                $group = $data->getObjectStateGroup();
                $updateStruct = $this->objectStateService->newObjectStateGroupUpdateStruct();
                $updateStruct->identifier = $data->getIdentifier();
                $updateStruct->names[$group->mainLanguageCode] = $data->getName();

                $updatedGroup = $this->objectStateService->updateObjectStateGroup($group, $updateStruct);

                $this->notificationHandler->success(
                    $this->translator->trans(
                        /** @Desc("Object state group '%name%' updated.") */
                        'object_state_group.update.success',
                        ['%name%' => $updatedGroup->getName()],
                        'object_state'
                    )
                );

                return $this->redirectToRoute('ezplatform.object_state.group.view', [
                    'objectStateGroupId' => $group->id,
                ]);
            });

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

        return $this->render('@ezdesign/admin/object_state_group/edit.html.twig', [
            'object_state_group' => $group,
            'form' => $form->createView(),
        ]);
    }
586178
public function insertObjectState(ObjectState $objectState, $groupId)
    {
        try {
            return $this->innerGateway->insertObjectState($objectState, $groupId);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
332334
public function createObjectState($objectStateGroupId, Request $request)
    {
        $objectStateGroup = $this->objectStateService->loadObjectStateGroup($objectStateGroupId);

        try {
            $createdObjectState = $this->objectStateService->createObjectState(
                $objectStateGroup,
                $this->inputDispatcher->parse(
                    new Message(
                        array('Content-Type' => $request->headers->get('Content-Type')),
                        $request->getContent()
                    )
                )
            );
        } catch (InvalidArgumentException $e) {
            throw new ForbiddenException($e->getMessage());
        }

        return new Values\CreatedObjectState(
            array(
                'objectState' => new RestObjectState(
                    $createdObjectState,
                    $objectStateGroup->id
                ),
            )
        );
    }
1339294
public function formAction(Request $request, $groupId)
    {
        $group = $this->get('open_orchestra_user.repository.group')->find($groupId);
        $this->denyAccessUnlessGranted(ContributionActionInterface::EDIT, $group);

        $form = $this->createForm('oo_group', $group, array(
            'action' => $this->generateUrl('open_orchestra_group_form', array(
                'groupId' => $groupId,
            )),
            'enable_delete_button' => $this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(ContributionActionInterface::DELETE, $group),
            'delete_button' => $this->isGranted(ContributionActionInterface::DELETE, $group)
        ));

        $form->handleRequest($request);
        $message = $this->get('translator')->trans('open_orchestra_group.form.group.edit.success');
        if ($this->handleForm($form, $message)) {
            $this->dispatchEvent(GroupEvents::GROUP_UPDATE, new GroupEvent($group));
        }

        return $this->renderAdminForm($form);
    }
1182285
public function update(TaxGroupRequest $request, TaxGroup $taxGroup)
    {
        $taxGroup->update($request->all());

        return redirect()->route('admin.tax-group.index');
    }
971719
public function handle($request, Closure $next, $group)
    {
        if ($this->auth->check() && $this->auth->user()->group() == $group) {
            return $next($request);
        }
        throw new GroupDeniedException($group);
    }