AndroMeta  2.0.0
AndroMeta/include/AndroMeta/MAuth.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2009-2012 AndroMeta LLC. All rights reserved.
00003  *
00004  * AndroMeta LLC retains all intellectual property and proprietary 
00005  * rights to this software and related documentation and any modifications 
00006  * thereto.  Any use, reproduction, disclosure, or distribution of this 
00007  * software and related documentation without an express license agreement 
00008  * from AndroMeta LLC is strictly prohibited.
00009  * 
00010  */
00011 
00018 #ifndef ANDROMETA_M_AUTH_H
00019 #define ANDROMETA_M_AUTH_H
00020 
00021 #include <AndroMeta/MObject.h>
00022 
00023 namespace Meta{
00024   
00036   class MAuth : public MObject{
00037   public:
00038     
00042     MAuth();
00043     
00047     MAuth(const mvar& v, RestoreOpt opt);
00048     
00052     MAuth(const MAuth& auth);
00053     
00057     ~MAuth();
00058     
00062     void store(mvar& v) const;
00063     
00076     bool addUser(const mstr& user,
00077                  const mstr& password,
00078                  const mvar& data=undef,
00079                  bool temporary=false); 
00080     
00084     mvec users() const;
00085     
00091     bool grantResource(const mstr& user, const mstr& resource);
00092     
00098     bool revokeResource(const mstr& user, const mstr& resource);
00099     
00105     bool removeUser(const mstr& user);
00106     
00113     bool authenticate(const mstr& user,
00114                       const mstr& key,
00115                       const mstr& resource="");
00116     
00120     const mvar& userData(const mstr& user) const;
00121     
00127     bool setUserData(const mstr& user, const mvar& data);
00128     
00133     void setAllowAll(bool flag);
00134     
00139     bool allowAll() const;
00140 
00146     void setCreateOnUnknown(bool flag);
00147     
00151     bool createOnUnknown() const;
00152 
00156     void setMaxUserLength(size_t chars);
00157     
00158   private:  
00159     MAuth& operator=(const MAuth&);
00160     
00161     class MAuth_* x_;
00162   };
00163   
00164 } // end namespace Meta
00165 
00166 #endif // ANDROMETA_M_AUTH_H