The Pedigree Project  0.1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
User Class Reference

#include <User.h>

+ Collaboration diagram for User:

Public Member Functions

 User (size_t uid, String username, String fullName, Group *pGroup, String home, String shell, String password)
 
virtual ~User ()
 
void join (Group *pGroup)
 
void leave (Group *pGroup)
 
bool isMember (Group *pGroup)
 
bool login (String password)
 
size_t getId ()
 
String getUsername ()
 
String getFullName ()
 
GroupgetDefaultGroup ()
 
String getHome ()
 
String getShell ()
 

Private Member Functions

 User ()
 
 User (const User &)
 
Useroperator= (const User &)
 

Private Attributes

size_t m_Uid
 
String m_Username
 
String m_FullName
 
Groupm_pDefaultGroup
 
String m_Home
 
String m_Shell
 
String m_Password
 
List< Group * > m_Groups
 

Detailed Description

Defines the properties of a User on the system.

Definition at line 32 of file User.h.

Constructor & Destructor Documentation

User::User ( size_t  uid,
String  username,
String  fullName,
Group pGroup,
String  home,
String  shell,
String  password 
)

Constructor

Parameters
uidThe user's system-wide unique ID.
nameThe user's username.
fullNameThe user's full name.
pGroupThe default group.
homeThe user's home directory.
shellThe user's default shell.
passwordPassword hash.
Note
Password hash not currently implemented - plaintext only.

Definition at line 28 of file User.cc.

User::~User ( )
virtual

The destructor does nothing.

Definition at line 37 of file User.cc.

User::User ( )
private

It doesn't make sense for a User to have a default or copy constructor.

Member Function Documentation

Group* User::getDefaultGroup ( )
inline

Retrieves the user's default group.

Definition at line 81 of file User.h.

Referenced by UserManager::initialise(), and WaitCleanup::terminated().

+ Here is the caller graph for this function:

String User::getFullName ( )
inline

Retrieves the user's full name.

Definition at line 76 of file User.h.

Referenced by WaitCleanup::terminated().

+ Here is the caller graph for this function:

String User::getHome ( )
inline

Retrieves the user's home directory.

Definition at line 86 of file User.h.

Referenced by WaitCleanup::terminated().

+ Here is the caller graph for this function:

size_t User::getId ( )
inline

Retrieves the user's UID.

Definition at line 66 of file User.h.

Referenced by ProcFs::addProcess(), Process::getUserId(), and WaitCleanup::terminated().

+ Here is the caller graph for this function:

String User::getShell ( )
inline

Retrieves the user's default shell.

Definition at line 91 of file User.h.

Referenced by WaitCleanup::terminated().

+ Here is the caller graph for this function:

String User::getUsername ( )
inline

Retrieves the user's username.

Definition at line 71 of file User.h.

Referenced by UserManager::getUser(), and WaitCleanup::terminated().

+ Here is the caller graph for this function:

bool User::isMember ( Group pGroup)

Queries a group membership.

Definition at line 59 of file User.cc.

References List< T, nodePoolSize >::begin(), List< T, nodePoolSize >::end(), m_Groups, and m_pDefaultGroup.

void User::join ( Group pGroup)

Adds a group membership.

Definition at line 41 of file User.cc.

References m_Groups, and List< T, nodePoolSize >::pushBack().

void User::leave ( Group pGroup)

Removes a group membership.

Definition at line 46 of file User.cc.

References List< T, nodePoolSize >::begin(), List< T, nodePoolSize >::end(), List< T, nodePoolSize >::erase(), and m_Groups.

bool User::login ( String  password)

(Attempts to) log in as this user. On success this process' user is set to this, and the group is set to this user's default group.

Returns
True on success, false on failure.

Definition at line 72 of file User.cc.

References Processor::information(), m_Password, m_pDefaultGroup, Process::setEffectiveUser(), Process::setGroup(), and Process::setUser().

Referenced by WaitCleanup::terminated().

+ Here is the caller graph for this function:

Member Data Documentation

String User::m_FullName
private

Full name

Definition at line 108 of file User.h.

List<Group *> User::m_Groups
private

Set of groups (excluding default group).

Definition at line 119 of file User.h.

Referenced by isMember(), join(), and leave().

String User::m_Home
private

Home directory.

Definition at line 112 of file User.h.

String User::m_Password
private

Password hash.

Definition at line 116 of file User.h.

Referenced by login().

Group* User::m_pDefaultGroup
private

Default group.

Definition at line 110 of file User.h.

Referenced by isMember(), and login().

String User::m_Shell
private

Default shell.

Definition at line 114 of file User.h.

size_t User::m_Uid
private

User ID

Definition at line 104 of file User.h.

String User::m_Username
private

Username

Definition at line 106 of file User.h.


The documentation for this class was generated from the following files: