36 , _nopasswordFile(nopasswordFile)
61 QJsonObject d = r->
_data.object();
63 bool auth = r->
_path ==
"";
65 QString user = auth ? d[
"username"].toString() : r->
_path;
68 if (!nopasswd.open(QIODevice::ReadOnly | QIODevice::Text))
75 QRegExp prx( QString(
"%1\\s?(\\d*)\\s?\"?([^\"]*)\"?\\s?([^\\s]*)\n").arg(user) );
76 while (!nopasswd.atEnd())
78 QString line( nopasswd.readLine() );
80 if (prx.exactMatch(line))
83 int c = prx.capturedTexts().length();
86 d[
"uidnumber"] = (c > 1) ? prx.cap(1).toInt() : 0;
87 d[
"realname"] = (c > 2) && prx.cap(2).size() ? prx.cap(2) : user;
88 d[
"groups"] = (c > 3) ? QJsonArray::fromStringList(prx.cap(3).split(
",")) : QJsonArray();
94 r->
_data.setObject(d);
114 if (!nopasswd.open(QIODevice::ReadOnly | QIODevice::Text))
123 QRegExp prx( QString(
"([^\\s]+)\\s?(\\d*)\\s?\"?([^\"]*)\"?\\s?([^\\s]*)\n") );
124 while (!nopasswd.atEnd())
126 QString line( nopasswd.readLine() );
128 if (prx.exactMatch(line))
131 int c = prx.capturedTexts().length();
140 QString username = prx.cap(1);
141 o[username] = QJsonObject { {
"username", username }, {
"uidnumber", prx.cap(2).toInt() }, {
"realname",prx.cap(3).trimmed().size() ? prx.cap(3) : username } };
146 QString username = prx.cap(1);
147 o[username] = QJsonObject { {
"username", username }, {
"uidnumber", prx.cap(2).toInt() }, {
"realname", username } };
152 QString username = prx.cap(1);
153 o[username] = QJsonObject { {
"username", username }, {
"uidnumber", 0 }, {
"realname", username } };
168 QJsonObject u = r->
_data.object();
172 r->
_data.setObject(u);
The base class for authenticating users.
virtual void ls(VFS_request *r)
List the users available for this auth method.
Q_INVOKABLE VFS_nopasswd(QString nopasswordFile)
virtual QString reportDetails()
Additional details for a generated report.
QString _nopasswordFile
The filesystem path to the nopasswd file.
virtual void read(VFS_request *r)
Perform an authentication request by read()ing from this node.
The base class for all requests between nodes.
QString _initialPath
the target path when the request was made (relative to the responder)
QString _reason
if something (probably bad) happened, this is the reason
QString _path
the target path remnant... the remaining path element once the request has found its target
bool _success
if the request was successfully completed
QJsonDocument _data
the request payload