21 explicit VFS_session(
VFS_node *client,
VFS_sessionManager *manager, QString user, QString type, QString home, QString authpath, QDateTime expires=QDateTime(), QString address=
"", QJsonObject parameters=QJsonObject(), QString
authtoken=
"");
28 static bool registerSessionType(QString type, QJsonObject definition, QJsonObject defaults=QJsonObject());
46 virtual QByteArray
icon();
The ACL class for maintaining permission to nodes.
VFS_node is the base class from which all other VFS_node classes derive.
The base class for all requests between nodes.
The VFS_session object represents a single session.
QString _realname
The real name of the user associated with this session.
virtual void timerEvent(QTimerEvent *event)
The timer event used to check if the session is still valid.
bool _initialized
false until initialization is complete
static QMutex _sessionTypesLock
A mutex to protect thread safety during initialization.
QDateTime _expires
The Expiration date/time of this session.
virtual void rm(VFS_request *r)
Remove (delete) this node, and also the _client associated with it.
QJsonObject _tokens
The tokens available to resolve session values.
static bool _initializedTypes
Whether or not VFS_session static variables have been initialized.
virtual QByteArray icon()
Return the user icon from VFS_icons.
static QJsonObject _sessionTypes
The registered session types. The entries here will be de-tokenized on read()
QQueue< VFS_request * > _initializers
The list of initialization requests which must be empty for _initialized to become true.
virtual void applyDiff(VFS_request *r)
Receive diffs from our subscriptions.
virtual void receiveResponse(VFS_request *t)
VFS_sessionManager::receiveResponse.
VFS_sessionManager * _manager
The sessionManager tracking this session.
QJsonObject resolveTokens(QJsonObject _data)
Resolve the tokens for a session type based on variables gathered in the _tokens object.
virtual void initializeUser(VFS_request *r)
Check and create session files for a user.
static QJsonValue fetchDefaultSessionValue(QString type, QString key)
Fetch a session type's default value by key, as registered by registerSessionType()
qint64 secondsToExpire()
Given the current time, calculate the number of seconds until this session will expire.
QString _type
The session or client type.
static QJsonObject _sessionDefaults
The default values, per type, per entry.
bool isMemberOf(QString group)
Check if this session's group list includes the specified group.
QJsonObject toJson()
Return a json object with the salient data from this session.
quint16 _uidnumber
The uidnumber of the user associated with this session.
QString _user
The username associated with this session.
QJsonArray _groups
The list of groups this user is a member of.
QString _authpath
The VFS_auth path that authenticated this session.
QString _address
The remote address of the client.
VFS_node * _client
The client this session is for, which will usually be a subclass of VFS_websocket_client.
static VFS_session * fetchSession(QString address)
Try to resolve and cast a string address to a VFS_session.
virtual QString reportDetails()
Report data about a connected client.
QString _home
The VFS path to this user's home directory.
void dequeueInitializer()
Remove the first initializer item from _initializers and call issueRequest().
QString _authtoken
The authtoken VFS path associated with this session, which corresponds to an entry at VFS_sessionMana...
QJsonObject _sessionData
The resolved session data for this user type.
QDateTime _created
The creation date/time of this session.
QString authtoken()
Return the file component of the _authtoken path.
static bool registerSessionType(QString type, QJsonObject definition, QJsonObject defaults=QJsonObject())
Register a new session type by name.
static void initializeTypes()
Initialize the VFS_session::_sessionTypes member.
int timerID
The ID of the session timer.
virtual bool isContainer()
A VFS_session cannot have children.
virtual void read(VFS_request *r)
Read the session data.
QJsonValue fetchSessionValue(QString key)
Fetch a value from the _sessionData, by key.
VFS_sessionManager manages connected clients and their session data.