incron 0.5.10

- Main Page
- Classes
- Files

- Class List
- Class Members

Public Member Functions | Static Public Member Functions
UserTable Class Reference

User table class. More...

`#include <usertable.h>`

List of all members.

## Public Member Functions
| UserTable (EventDispatcher *pEd, const std::string &rUser, bool fSysTable)
| Constructor.
virtual | ~UserTable ()
| Destructor.
void | Load ()
| Loads the table.
void | Dispose ()
| Removes all entries from the table.
void | OnEvent (InotifyEvent &rEvt)
| Processes an inotify event.
bool | MayAccess (const std::string &rPath, bool fNoFollow) const
| Checks whether the user may access a file.
bool | IsSystem () const
| Checks whether it is a system table.
Inotify * | GetInotify ()
| Returns the related inotify object.
void | RunAsUser (char *const *argv) const
| Runs a program as the table's user.
## Static Public Member Functions
static void | FinishDone ()
| Cleans-up all zombie child processes and enables disabled watches.
static bool | CheckUser (const char *user)
| Checks whether an user exists and has permission to use incron.

## Detailed Description

User table class.

This class processes inotify events for an user. It creates child processes which do appropriate actions as defined in the user table file.

## Constructor & Destructor Documentation

UserTable::UserTable | ( | EventDispatcher * | pEd,
|  | const std::string & | rUser,
|  | bool | fSysTable
| ) |  |

Constructor.

Parameters:

  [in] | pEd | event dispatcher
  [in] | rUser | user name
  [in] | fSysTable | system table yes/no

UserTable::~UserTable | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

static bool UserTable::CheckUser | ( | const char * | user | ) | `[inline, static]`

Checks whether an user exists and has permission to use incron.

It searches for the given user name in the user database. If it failes it returns 'false'. Otherwise it checks permission files for this user (see InCronTab::CheckUser()).

Parameters:

  [in] | user | user name

Returns:
  true = user has permission to use incron, false = otherwise

See also:
  InCronTab::CheckUser()

void UserTable::Dispose | ( |  | ) |

Removes all entries from the table.

All entries are unregistered from the event dispatcher and their watches are destroyed.

void UserTable::FinishDone | ( |  | ) | `[static]`

Cleans-up all zombie child processes and enables disabled watches.

Attention:
  This method must be called AFTER processing all events which has been caused by the processes.

Inotify* UserTable::GetInotify | ( |  | ) | `[inline]`

Returns the related inotify object.

Returns:
  related inotify object

bool UserTable::IsSystem | ( |  | ) | const

Checks whether it is a system table.

Returns:
  true = system table, false = user table

void UserTable::Load | ( |  | ) |

Loads the table.

All loaded entries have their inotify watches and are registered for event dispatching. If loading fails the table remains empty.

bool UserTable::MayAccess | ( | const std::string & | rPath,
|  | bool | fNoFollow
| ) |  | const

Checks whether the user may access a file.

Any access right (RWX) is sufficient.

Parameters:

  [in] | rPath | absolute file path
  [in] | fNoFollow | don't follow a symbolic link

Returns:
  true = access granted, false = otherwise

void UserTable::OnEvent | ( | InotifyEvent & | rEvt | ) |

Processes an inotify event.

Parameters:

  [in] | rEvt | inotify event

void UserTable::RunAsUser | ( | char *const * | argv | ) | const

Runs a program as the table's user.

Attention:
  Don't call from the main process (before forking)!

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

- usertable.h
- usertable.cpp