privileges :: UserGroup :: defaultinit
privileges :: UserGroup :: drop_privileges
Drop privileges of the running program to those ofself
			privileges $ UserGroup :: SELF
Type of this instance, automatically specialized in every classcore :: Object :: class_factory
Implementation used byget_class to create the specific class.
			privileges :: UserGroup :: defaultinit
core :: Object :: defaultinit
privileges :: UserGroup :: drop_privileges
Drop privileges of the running program to those ofself
			core :: Object :: is_same_instance
Return true ifself and other are the same instance (i.e. same identity).
			core :: Object :: is_same_serialized
Isself the same as other in a serialization context?
			core :: Object :: is_same_type
Return true ifself and other have the same dynamic type.
			core :: Object :: output_class_name
Display class name on stdout (debug only).
# Class to manage user groups
class UserGroup
	# User name
	var user: String
	# Group name
	var group: nullable String
	# Drop privileges of the running program to those of `self`
	#
	# require: `user.user_exists and (group == null or group.group_exists)`
	fun drop_privileges
	do
		var passwd = new Passwd.from_name(user)
		assert not passwd.address_is_null
		var uid = passwd.uid
		var group = group
		var gid
		if group != null then
			var gpasswd = new Group.from_name(group)
			assert not gpasswd.address_is_null
			gid = gpasswd.gid
		else gid = passwd.gid
		sys.gid = gid
		sys.uid = uid
	end
end
					lib/privileges/privileges.nit:42,1--71,3