Struct users::mock::MockUsers
[−]
[src]
pub struct MockUsers {
// some fields omitted
}A mocking users object that you can add your own users and groups to.
Methods
impl MockUsers[src]
fn with_current_uid(current_uid: uid_t) -> MockUsers
Create a new, empty mock users object.
fn add_user(&mut self, user: User) -> Option<Arc<User>>
Add a user to the users table.
fn add_group(&mut self, group: Group) -> Option<Arc<Group>>
Add a group to the groups table.
Trait Implementations
impl Users for MockUsers[src]
fn get_user_by_uid(&self, uid: uid_t) -> Option<Arc<User>>
Returns a User if one exists for the given user ID; otherwise, returns None.
fn get_user_by_name(&self, username: &str) -> Option<Arc<User>>
Returns a User if one exists for the given username; otherwise, returns None.
fn get_current_uid(&self) -> uid_t
Returns the user ID for the user running the process.
fn get_current_username(&self) -> Option<Arc<String>>
Returns the username of the user running the process.
fn get_effective_uid(&self) -> uid_t
Returns the effective user id.
fn get_effective_username(&self) -> Option<Arc<String>>
Returns the effective username.
impl Groups for MockUsers[src]
fn get_group_by_gid(&self, gid: gid_t) -> Option<Arc<Group>>
Returns a Group object if one exists for the given group ID; otherwise, returns None.
fn get_group_by_name(&self, group_name: &str) -> Option<Arc<Group>>
Returns a Group object if one exists for the given groupname; otherwise, returns None.
fn get_current_gid(&self) -> uid_t
Returns the group ID for the user running the process.
fn get_current_groupname(&self) -> Option<Arc<String>>
Returns the group name of the user running the process.
fn get_effective_gid(&self) -> uid_t
Returns the effective group id.
fn get_effective_groupname(&self) -> Option<Arc<String>>
Returns the effective group name.