CStaticRightsProviderComp.h
Go to the documentation of this file.
1 #ifndef iauth_CStaticRightsProviderComp_included
2 #define iauth_CStaticRightsProviderComp_included
3 
4 
5 // Qt includes
6 #include <QtCore/QByteArray>
7 #include <QtCore/QSet>
8 
9 // ACF includes
10 #include "icomp/CComponentBase.h"
11 
12 // ACF-Solutions includes
13 #include "iauth/IRightsProvider.h"
14 
15 
16 namespace iauth
17 {
18 
19 
21  public icomp::CComponentBase,
22  public IRightsProvider
23 {
24 public:
26 
27  I_BEGIN_COMPONENT(CStaticRightsProviderComp);
28  I_REGISTER_INTERFACE(IRightsProvider);
29  I_ASSIGN(m_slaveProviderIfPtr, "SlaveProvider", "Slave rights provider", false, "SlaveProvider");
30  I_ASSIGN(m_defaultRightAttrPtr, "DefaultRight", "Default rights enabled", false, false);
31  I_ASSIGN_MULTI_0(m_rightsOnAttrPtr, "RightsOn", "List of enabled rights", false);
32  I_ASSIGN_MULTI_0(m_rightsOffAttrPtr, "RightsOff", "List of disabled rights", false);
33  I_END_COMPONENT;
34 
35  // reimeplemented (IRightsProvider)
36  virtual bool HasRight(
37  const QByteArray& operationId,
38  bool beQuiet = false) const;
39 
40 protected:
41  // reimplemented (icomp::CComponentBase)
42  virtual void OnComponentCreated();
43 
44 private:
45  I_REF(IRightsProvider, m_slaveProviderIfPtr);
46  I_ATTR(bool, m_defaultRightAttrPtr);
47  I_MULTIATTR(QString, m_rightsOnAttrPtr);
48  I_MULTIATTR(QString, m_rightsOffAttrPtr);
49 
50  typedef QSet<QByteArray> RightsList;
51 
52  RightsList m_rightsOn;
53  RightsList m_rightsOff;
54 };
55 
56 
57 
58 } // namespace iauth
59 
60 
61 
62 #endif // !iauth_CStaticRightsProviderComp_included
63 
64 
65 
virtual bool HasRight(const QByteArray &operationId, bool beQuiet=false) const
Checks if user has rights for specific operation.

© 2007-2011 Witold Gantzke and Kirill Lepskiy