function XMLRPCremoveUserGroupPriv($name, $affiliation, $nodeid, $permissions) {
	require_once(".ht-inc/privileges.php");
	global $user;

	if(! is_numeric($nodeid)) {
		return array('status' => 'error',
		             'errorcode' => 78,
		             'errormsg' => 'Invalid nodeid specified');
	}

	if(! checkUserHasPriv("userGrant", $user['id'], $nodeid)) {
		return array('status' => 'error',
		             'errorcode' => 65,
		             'errormsg' => 'Unable to remove user group privileges on this node');
	}

	$validate = array('name' => $name,
	                  'affiliation' => $affiliation);
	$rc = validateAPIgroupInput($validate, 1);
	if($rc['status'] == 'error')
		return $rc;

	$groupid = $rc['id'];
	#$name = "$name@$affiliation";
	$perms = explode(':', $permissions);
	$usertypes = getTypes('users');
	array_push($usertypes["users"], "block");
	array_push($usertypes["users"], "cascade");

	$diff = array_diff($perms, $usertypes['users']);
	if(count($diff)) {
		return array('status' => 'error',
		             'errorcode' => 66,
		             'errormsg' => 'Invalid or missing permissions list supplied');
	}

	$cnp = getNodeCascadePrivileges($nodeid, "usergroups");
	$np = getNodePrivileges($nodeid, "usergroups");

	if(array_key_exists($name, $cnp['usergroups']) &&
	   (! array_key_exists($name, $np['usergroups']) ||
	   ! in_array('block', $np['usergroups'][$name]))) {
		$intersect = array_intersect($cnp['usergroups'][$name]['privs'], $perms);
		if(count($intersect)) {
			return array('status' => 'error',
			             'errorcode' => 80,
			             'errormsg' => 'Unable to modify privileges cascaded to this node');
		}
	}

	$diff = array_diff($np['usergroups'][$name]['privs'], $perms);
	if(count($diff) == 1 && in_array("cascade", $diff))
		array_push($perms, "cascade");

	updateUserOrGroupPrivs($groupid, $nodeid, array(), $perms, "group");
	return array('status' => 'success');
}
Weaknesses in this category are related to the management of permissions, privileges, and other security features that are used to perform access control.