RESTful endpoint for deleting a role.
174295
@DELETE
    @Path("{group}/{id}")
    public SuccessResponse deleteRole(@PathParam("group") String group, @PathParam("id") String id,
                                      final @Authenticated Subject subject) {
        _uac.deleteRole(subject, new EmoRoleKey(group, id));
        return SuccessResponse.instance();
    }
89223
public function deletePolicy($roleId, $policyId, Request $request)
    {
        try {
            // First try to treat $roleId as a role draft ID.
            $roleDraft = $this->roleService->loadRoleDraft($roleId);

            $policy = null;
            foreach ($roleDraft->getPolicies() as $rolePolicy) {
                if ($rolePolicy->id == $policyId) {
                    $policy = $rolePolicy;
                    break;
                }
            }

            if ($policy !== null) {
                $this->roleService->removePolicyByRoleDraft($roleDraft, $policy);

                return new Values\NoContent();
            }
        } catch (NotFoundException $e) {
            // Then try to treat $roleId as a role ID.
            $role = $this->roleService->loadRole($roleId);

            $policy = null;
            foreach ($role->getPolicies() as $rolePolicy) {
                if ($rolePolicy->id == $policyId) {
                    $policy = $rolePolicy;
                    break;
                }
            }

            if ($policy !== null) {
                $this->roleService->deletePolicy($policy);

                return new Values\NoContent();
            }
        }

        throw new Exceptions\NotFoundException("Policy not found: '{$request->getPathInfo()}'.");
    }
1349694
@Path("/{cuid}/rel/{relId}")
    @ApiOperation(value="Delete a user or remove a user from a workgroup or role",
        notes="If rel/{relId} is present, user is removed from workgroup or role.", response=StatusMessage.class)
    public JSONObject delete(String path, JSONObject content, Map<String,String> headers)
    throws ServiceException, JSONException {
        String cuid = getSegment(path, 1);
        String rel = getSegment(path, 2);

        UserServices userServices = ServiceLocator.getUserServices();
        try {
            if (rel == null) {
                if (userServices.getUser(cuid) == null)
                    throw new ServiceException(ServiceException.NOT_FOUND, "User not found: " + cuid);
                userServices.deleteUser(cuid);
            }
            else if (rel.equals("workgroups")) {
                String group = getSegment(path, 3);
                userServices.removeUserFromWorkgroup(cuid, group);
            }
            else if (rel.equals("roles")) {
                String role = getSegment(path, 3);
                userServices.removeUserFromRole(cuid, role);
            }
        }
        catch (DataAccessException ex) {
            throw new ServiceException(HTTP_500_INTERNAL_ERROR, ex.getMessage(), ex);
        }
        return null;
    }
815001
def delete(self, json=None):
        
        return self._call('delete', url=self.endpoint, json=json)
143410
def rest(path, params)
      endpoints = (params.delete(:only) || [:index, :show, :create, :update, :destroy]).to_a
      endpoints = endpoints - params.delete(:except).to_a
      endpoints.each do |endpoint|
        self.send(('restful_' + endpoint.to_s).to_sym, path, params)
      end
    end
777427
public function deleteAction(Request $request, Role $role): Response
    {
        $this->denyAccessUnlessGranted(new Attribute('role', 'delete'));
        $form = $this->formFactory->deleteRole(
            new RoleDeleteData($role)
        );
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (RoleDeleteData $data) {
                $role = $data->getRole();
                $this->roleService->deleteRole($role);

                $this->notificationHandler->success(
                    $this->translator->trans(
                        /** @Desc("Role '%role%' removed.") */
                        'role.delete.success',
                        ['%role%' => $role->identifier],
                        'role'
                    )
                );

                return new RedirectResponse($this->generateUrl('ezplatform.role.list'));
            });

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

        return $this->redirect($this->generateUrl('ezplatform.role.view', [
            'roleId' => $role->id,
        ]));
    }
204605
public function destroy(Request $request, Role $role)
    {
        $this->authorize('delete', Role::class);
        $role->deletePermissions($role->permissions);
        $role->deleteUsers($role->users);

        $role->delete();

        return redirect()->route('laralum::roles.index')->with('success', __('laralum_roles::general.role_deleted', ['id' => $role->id]));
    }
1054354
public Request delete(String roleId) {
    Asserts.assertNotNull(roleId, "role id");

    final String url = baseUrl
        .newBuilder()
        .addEncodedPathSegments("api/v2/roles")
        .addEncodedPathSegments(roleId)
        .build()
        .toString();
    VoidRequest request = new VoidRequest(this.client, url, "DELETE");
    request.addHeader("Authorization", "Bearer " + apiToken);
    return request;
  }
371522
def delete(self, data, *args):
        
        path = self.get_resource_name()
        result = self.perform_api_call(self.REST_DELETE, path, data=data)
        return result
616868
public function bulkDeleteAction(Request $request, Role $role): Response
    {
        $this->denyAccessUnlessGranted(new Attribute('role', 'assign'));
        $form = $this->formFactory->deleteRoleAssignments(
            new RoleAssignmentsDeleteData()
        );
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (RoleAssignmentsDeleteData $data) use ($role) {
                foreach ($data->getRoleAssignments() as $roleAssignmentId => $selected) {
                    $roleAssignment = $this->roleService->loadRoleAssignment($roleAssignmentId);
                    $this->roleService->removeRoleAssignment($roleAssignment);
                }

                $this->notificationHandler->success(
                    $this->translator->trans(
                        /** @Desc("Assignment on role '%role%' removed.") */
                        'role.assignment_delete.success',
                        ['%role%' => $role->identifier],
                        'role'
                    )
                );

                return new RedirectResponse($this->generateUrl('ezplatform.role.view', [
                    'roleId' => $role->id,
                ]));
            });

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

        return $this->redirect($this->generateUrl('ezplatform.role.view', [
            'roleId' => $role->id,
        ]));
    }
1059319
def _delete(self, **kwargs):
        """"""
        path = self._construct_path_to_item()
        return self._http.delete(path)
192382
def delete_ec2_role(self, role, mount_point='aws-ec2'):
        
        return self._adapter.delete('/v1/auth/{0}/role/{1}'.format(mount_point, role))
1308455
def delete(self, endpoint: str, **kwargs) -> dict:
        """"""

        return self._request('DELETE', endpoint, **kwargs)
636422
def delete(self, resource_id):
        

        endpoint = '{}/{}'.format(self.endpoint, resource_id)

        response = self.api.execute("DELETE", endpoint)

        if not response.ok:
            raise Error.parse(response.json())

        return self._cls.parse(response.json())
664914
def clear_roles(user):
    """"""
    roles = get_user_roles(user)

    for role in roles:
        role.remove_role_from_user(user)

    return roles
536611
def _role_remove(name, user=None, host=None, port=None, maintenance_db=None,
                 password=None, runas=None):
    '''
    
    '''

    # check if user exists
    if not user_exists(name, user, host, port, maintenance_db,
                       password=password, runas=runas):
        log.info('User \'%s\' does not exist', name)
        return False

    # user exists, proceed
    sub_cmd = 'DROP ROLE "{0}"'.format(name)
    _psql_prepare_and_run(
        ['-c', sub_cmd],
        runas=runas, host=host, user=user, port=port,
        maintenance_db=maintenance_db, password=password)

    if not user_exists(name, user, host, port, maintenance_db,
                       password=password, runas=runas):
        return True
    else:
        log.info('Failed to delete user \'%s\'.', name)
        return False
639351
async def delete(self, request, resource=None, **kwargs):
        """"""
        if resource is None:
            raise RESTNotFound(reason='Resource not found')
        self.collection.remove(resource)