Function login_cap::setclasscontext[][src]

pub fn setclasscontext(class: &str, flags: LoginFlagsOr) -> Result<(), Error>
Expand description

Set the class context using resources defined by flags

Example:

assert!(setclasscontext("default", LoginFlags::SetEnv.into()).is_ok());
assert!(setclasscontext("default", LoginFlags::SetEnv | LoginFlags::SetUmask).is_ok());
// invalid class
assert!(setclasscontext("not-a-class", LoginFlags::SetEnv.into()).is_err());

From login_getclass(3):

 The setclasscontext() function takes class, the name of a user class, and
 sets the resources defined by that class according to flags.  Only the
 LOGIN_SETPATH, LOGIN_SETPRIORITY, LOGIN_SETRESOURCES, and LOGIN_SETUMASK
 bits are used (see setusercontext() below).  It returns 0 on success and
 -1 on failure.