nautilus_file_can_set_group (NautilusFile *file)
{
	uid_t user_id;

	/* Not allowed to set the permissions if we can't
	 * even read them. This can happen on non-UNIX file
	 * systems.
	 */
	if (!nautilus_file_can_get_group (file)) {
		return FALSE;
	}

	/* Check the user. */
	user_id = geteuid();

	/* Owner is allowed to set group (with restrictions). */
	if (user_id == (uid_t) file->details->uid) {
		return TRUE;
	}

	/* Root is also allowed to set group. */
	if (user_id == 0) {
		return TRUE;
	}

	/* Nobody else is allowed. */
	return FALSE;
}
nautilus_file_can_set_group (NautilusFile *file)
{
	uid_t user_id;

	 
	if (!nautilus_file_can_get_group (file)) {
		return FALSE;
	}

	 
	user_id = geteuid();

	 
	if (user_id == (uid_t) file->details->uid) {
		return TRUE;
	}

	 
	if (user_id == 0) {
		return TRUE;
	}

	 
	return FALSE;
}