Delete a Group Category.

        Deletes a group category and all groups under it. Protected group
        categories can not be deleted, i.e. "communities" and "student_organized".
545348
def delete_group_category(self, group_category_id):
        
        path = {}
        data = {}
        params = {}

        # REQUIRED - PATH - group_category_id
        """ID"""
        path["group_category_id"] = group_category_id

        self.logger.debug("DELETE /api/v1/group_categories/{group_category_id} with query params: {params} and form data: {data}".format(params=params, data=data, **path))
        return self.generic_request("DELETE", "/api/v1/group_categories/{group_category_id}".format(**path), data=data, params=params, no_data=True)
919800
def _delete_security_groups(self):
    
    group_names = self._get_all_group_names_for_cluster()
    for group in group_names:
      self.ec2.delete_security_group(group)
427831
public Response deleteAdminGroup(String roomName, String groupName) {
        return restClient.delete("chatrooms/" + roomName + "/admins/group/" + groupName,
                new HashMap<String, String>());
    }
615888
function(oDD, sGroup) {
            if (!this.ids[sGroup]) {
                this.ids[sGroup] = {};
            }

            var obj = this.ids[sGroup];
            if (obj && obj[oDD.id]) {
                delete obj[oDD.id];
            }
        }
1078251
def deletegroupmember(self, group_id, user_id):
        
        request = requests.delete(
            '{0}/{1}/members/{2}'.format(self.groups_url, group_id, user_id),
            headers=self.headers, verify=self.verify_ssl, auth=self.auth, timeout=self.timeout)

        if request.status_code == 200:
            return True
1318148
public function delete()
    {
        // we will NOT let you delete the required groups
        if ($this->gID == REGISTERED_GROUP_ID || $this->gID == GUEST_GROUP_ID) {
            return false;
        }

        // run any internal event we have for group deletion
        $ge = new DeleteEvent($this);
        $ge = Events::dispatch('on_group_delete', $ge);
        if (!$ge->proceed()) {
            return false;
        }

        $tree = GroupTree::get();
        $rootNode = $tree->getRootTreeNodeObject();
        $node = GroupTreeNode::getTreeNodeByGroupID($this->gID);
        if (is_object($node) && is_object($rootNode)) {
            $node->populateDirectChildrenOnly();
            foreach ($node->getChildNodes() as $childnode) {
                $childnode->move($rootNode);
            }
            $node = GroupTreeNode::getTreeNodeByGroupID($this->gID);
            $node->delete();
        }

        $db = Database::connection();
        $db->query('DELETE FROM UserGroups WHERE gID = ?', [intval($this->gID)]);
        $db->query('DELETE FROM ' . $db->getDatabasePlatform()->quoteSingleIdentifier('Groups') . ' WHERE gID = ?', [(int) $this->gID]);
    }
1302564
def delete(options = {})
      options = options.merge(
        group_name: @group_name,
        policy_name: @name
      )
      resp = @client.delete_group_policy(options)
      resp.data
    end
245796
def GroupsUsersDelete(self, group_id, user_id):
        
        if self.__SenseApiCall__('/groups/{group_id}/users/{user_id}.json'.format(group_id = group_id, user_id = user_id), 'DELETE'):
            return True
        else:
            self.__error__ = "api call unsuccessful"
            return False
1119666
def delete_group(group_id, tasks=False, cached=Conf.CACHED):
    
    if cached:
        return delete_group_cached(group_id)
    return Task.delete_group(group_id, tasks)
915896
public function destroy(Category $category)
    {
        $this->category->destroy($category);

        return redirect()->route('admin.product.category.index')
            ->withSuccess(trans('core::core.messages.resource deleted', ['name' => trans('product::categories.title.categories')]));
    }
43383
def remove_from_category(self, category):
        
        ctype = ContentType.objects.get_for_model(self)
        self.categories.model.objects.filter(category=category, content_type=ctype, object_id=self.id).delete()
254293
protected function deleteImagesCategory()
    {
        $this->controlAccess('category_edit');

        $file_ids = $this->getPosted('delete_images', array(), true, 'array');
        return $this->image->delete($file_ids);
    }
1230635
def delete(self, ids):
        
        url = build_uri_with_ids('api/v3/object-group-perm-general/%s/', ids)
        return super(ApiObjectGroupPermissionGeneral, self).delete(url)
929686
public function deleteGroup (Group $group)
    {
        $this->client->send(
            new Request(
                'POST',
                'https://api.weixin.qq.com/cgi-bin/groups/delete',
                [],
                json_encode([
                    'group' => [
                        'id' => $group->getID(),
                    ],
                ])
            )
        );
    }
1263110
def delete_attribute_group(group_id, **kwargs):
    
    user_id = kwargs['user_id']

    try:

        group_i = db.DBSession.query(AttrGroup).filter(AttrGroup.id==group_id).one()

        group_i.project.check_write_permission(user_id)

        db.DBSession.delete(group_i)
        db.DBSession.flush()

        log.info("Group %s in project %s deleted", group_i.id, group_i.project_id)
    except NoResultFound:

        raise HydraError('No Attribute Group %s was found', group_id)


    return 'OK'
47027
public static function deleteAllGroups()
	{
		$conn = self::getLDO();

		if (empty($conn))
		{
			self::$errors['fatal'][] = 'LDAP connection failed';
			return self::$errors;
		}

		// delete all old hubGroup schema based group entries
		$ldap_params = \Component::params('com_system');
		$hubLDAPBaseDN = $ldap_params->get('ldap_basedn', '');

		$dn = "ou=groups," . $hubLDAPBaseDN;
		$filter = '(objectclass=hubGroup)';

		$sr = ldap_search($conn, $dn, $filter, array('gid','cn'), 0, 0, 0);

		$gids = array();

		if ($sr !== false)
		{
			if (ldap_count_entries($conn, $sr) !== false)
			{
				$entry = ldap_first_entry($conn, $sr);

				while ($entry !== false)
				{
					$attr = ldap_get_attributes($conn, $entry);

					if (array_key_exists('gid', $attr))
					{
						$gids[] = "gid=" . $attr['gid'][0] . "," .  "ou=groups," . $hubLDAPBaseDN;
					}
					else if (array_key_exists('cn', $attr))
					{
						$gids[] = "cn=" . $attr['cn'][0] . "," .  "ou=groups," . $hubLDAPBaseDN;
					}

					$entry = ldap_next_entry($conn, $entry);
				}
			}
		}

		foreach ($gids as $giddn)
		{
			$result = ldap_delete($conn, $giddn);

			if ($result !== true)
			{
				self::$errors['warning'][] = ldap_error($conn);
			}
			else
			{
				++self::$success['deleted'];
			}
		}

		// delete all entries that have mysql counterparts
		// @TODO: chunk this to 1000 groups at a time

		$db = \App::get('db');

		$query = "SELECT cn FROM `#__xgroups`;";

		$db->setQuery($query);

		$result = $db->loadColumn();

		if ($result === false)
		{
			return false;
		}

		foreach ($result as $row)
		{
			$dn = "cn=$row," .  "ou=groups," . $hubLDAPBaseDN;

			// Added this search because the delete will error on a delete of a non existent object
			$sr = ldap_search($conn, "ou=groups," . $hubLDAPBaseDN, "cn=$row", array('cn'), 0, 0, 0);
			if (($sr !== false) and ldap_count_entries($conn, $sr) == 1)
			{
				$result = ldap_delete($conn, $dn);

				if ($result !== true)
				{
					// Don't report errors for "not such object" warnings
					if (ldap_errno($conn) != 32)
					{
						self::$errors['warning'][] = ldap_error($conn);
					}
				}
				else
				{
					++self::$success['deleted'];
				}
			}
		}

		// Delete any remaining items with gid > 1000
		$dn = "ou=groups," . $hubLDAPBaseDN;
		$filter = '(&(objectclass=posixGroup)(gidNumber>=1000))';

		$sr = ldap_search($conn, $dn, $filter, array('cn'), 0, 0, 0);

		$gids = array();

		if ($sr !== false)
		{
			if (ldap_count_entries($conn, $sr) !== false)
			{
				$entry = ldap_first_entry($conn, $sr);

				while ($entry !== false)
				{
					$attr = ldap_get_attributes($conn, $entry);

					$gids[] = $attr['cn'][0];

					$entry = ldap_next_entry($conn, $entry);
				}
			}
		}

		foreach ($gids as $gid)
		{
			$dn = "cn=$gid," . "ou=groups," . $hubLDAPBaseDN;
			$result = ldap_delete($conn, $dn);

			if ($result !== true)
			{
				self::$errors['warning'][] = ldap_error($conn);
			}
			else
			{
				++self::$success['deleted'];
			}
		}

		if (!empty(self::$errors['fatal'][0]) || !empty(self::$errors['warning'][0]))
		{
			return self::$errors;
		}
		else
		{
			return self::$success;
		}
	}
1306101
private void deleteGroup(List<Segment> group) {
    // Delete the old segments.
    for (Segment oldSegment : group) {
      oldSegment.close();
      oldSegment.delete();
    }
  }