Remoto - VFS: VFS_auth.cpp Source File
Remoto - VFS
VFS_auth.cpp
Go to the documentation of this file.
1 
2 #include "VFS.h"
3 #include "VFS_base/VFS_icons.h"
4 
5 #include "VFS_auth.h"
6 
19 : VFS_node()
20 {
21 }
22 
24 {
25 }
26 
32 QByteArray VFS_auth::icon()
33 {
34  return VFS_icons::get("users");
35 }
36 
48 {
49  Q_UNUSED(r)
50 
51  return this;
52 }
53 
60 {
61  return false;
62 }
63 
74 {
75  /*
76  ls: '/' list all users that exist, regardless of login status
77  create: '/' create (write) new user
78  rm: '/' remove user
79  read: '/' validate user, based on password/authtoken in metadata
80  write: '/' update user's credentials
81  metadata: '/' default
82  report: '/' default
83  diff: '/' N/A ?
84  submit: '/' validate user's credentials
85  subscribe: '/' default
86  unsubscribe: '/' default
87  */
88 
89  switch(t->_requestType)
90  {
91  //for getting an icon
92  case VFS_request::metadata: metadata(t); break;
93 
94  //for validating credentials
95  case VFS_request::read: read(t); break;
96 
97  //for updating credentials
98  //case VFS_request::write: write(t); break;
99 
100  //for creating new credentials
101  //case VFS_request::create: write(t): break;
102 
103  //for listing the available users in an auth node
104  case VFS_request::ls: ls(t); break;
105 
106  //for reporting
107  case VFS_request::report: report(t); break;
108 
109  //default: return VFS_node::executeRequest(t);
110  default: t->_success = false;
111  t->_reason = QString("Unsupported auth request type: %1").arg(VFS_request::requestTypeStrings[t->_requestType]);
112  break;
113  }
114 
115  if (!t->_isCallback) //some auth methods are asynchronous and will use callback methods.
116  issueResponse(t);
117 }
VFS_auth()
Definition: VFS_auth.cpp:18
virtual VFS_node * find(VFS_request *r)
Find a node using a VFS_request.
Definition: VFS_auth.cpp:47
virtual QByteArray icon()
Return the users icon from VFS_icons.
Definition: VFS_auth.cpp:32
virtual bool isContainer()
A VFS_auth node cannot contain children.
Definition: VFS_auth.cpp:59
virtual void executeRequest(VFS_request *t)
Execute a VFS_request.
Definition: VFS_auth.cpp:73
virtual ~VFS_auth()
Definition: VFS_auth.cpp:23
static char * get(QString which="")
Fetch an icon from the library.
Definition: VFS_icons.cpp:34
VFS_node is the base class from which all other VFS_node classes derive.
Definition: VFS_node.h:143
virtual void read(VFS_request *r)
Return the data contents of this node, or if it's a container call ls()
Definition: VFS_node.cpp:724
virtual void issueResponse(VFS_request *t)
Once a request has been completed, issue a response.
Definition: VFS_node.cpp:1981
virtual void metadata(VFS_request *r)
Fetch the metadata of this node.
Definition: VFS_node.cpp:797
virtual void report(VFS_request *r)
Report debugging information about the current state of this node.
Definition: VFS_node.cpp:817
virtual void ls(VFS_request *r)
List the contents of this node.
Definition: VFS_node.cpp:692
The base class for all requests between nodes.
Definition: VFS_node.h:54
static const char * requestTypeStrings[]
A printable string for each request type.
Definition: VFS_node.h:127
@ read
read full contents (4)
Definition: VFS_node.h:68
@ report
provide node report, for debugging (12)
Definition: VFS_node.h:76
@ ls
list children of a node (1)
Definition: VFS_node.h:65
@ metadata
read metadata (6)
Definition: VFS_node.h:70
requestType _requestType
the action this request is performing or requesting
Definition: VFS_node.h:87
QString _reason
if something (probably bad) happened, this is the reason
Definition: VFS_node.h:108
bool _isCallback
whether or not to issue a response (IE, another request is chained to this request,...
Definition: VFS_node.h:98
bool _success
if the request was successfully completed
Definition: VFS_node.h:107