privileges :: OptionUserAndGroup :: for_dropping_privileges
Create anOptionUserAndGroup
for dropping privileges
privileges $ OptionUserAndGroup :: SELF
Type of this instance, automatically specialized in every classprivileges $ OptionUserAndGroup :: VALUE
Type of the value of the optionprivileges $ OptionUserAndGroup :: convert
Convertstr
to a value of type VALUE
.
opts :: OptionParameter :: _parameter_mandatory
Is the parameter mandatory?core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
opts :: Option :: default_value=
Default value of this optionopts :: Option :: defaultinit
Create a new optionopts :: OptionParameter :: defaultinit
core :: Object :: defaultinit
privileges :: OptionUserAndGroup :: for_dropping_privileges
Create anOptionUserAndGroup
for dropping privileges
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 :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).opts :: OptionParameter :: parameter_mandatory
Is the parameter mandatory?opts :: OptionParameter :: parameter_mandatory=
Is the parameter mandatory?opts :: Option :: read_param
Consume parameters for this option
# Option to ask for a username and group
class OptionUserAndGroup
super OptionParameter
redef type VALUE: nullable UserGroup
# Create an `OptionUserAndGroup` for dropping privileges
init for_dropping_privileges
do
init("Drop privileges to user:group or simply user", null, ["-u", "--usergroup"])
end
redef fun convert(str)
do
var words = str.split(":")
if words.length == 1 then
return new UserGroup(str, null)
else if words.length == 2 then
return new UserGroup(words[0], words[1])
else
errors.add("Option {names.join(", ")} expected parameter in the format \"user:group\" or simply \"user\".\n")
return null
end
end
end
lib/privileges/privileges.nit:73,1--97,3