|
1 /* |
|
2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: header file for dm acl parser |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __NSMLDMACLPARSER_H |
|
19 #define __NSMLDMACLPARSER_H |
|
20 |
|
21 #include <nsmldmdbhandler.h> |
|
22 |
|
23 |
|
24 // =========================================================================== |
|
25 // CNSmlDmACLParser |
|
26 // =========================================================================== |
|
27 class CNSmlAclElement; |
|
28 |
|
29 /** |
|
30 * CNSmlDmACLParser is used for parsing and generating acl strings from |
|
31 * structures and vice versa |
|
32 * |
|
33 * @since |
|
34 */ |
|
35 class CNSmlDmACLParser : public CBase |
|
36 { |
|
37 public: |
|
38 |
|
39 /** |
|
40 * Two-phased constructor |
|
41 * @return Pointer to newly created module instance |
|
42 */ |
|
43 static CNSmlDmACLParser* NewLC(); |
|
44 |
|
45 /** |
|
46 * Destructor |
|
47 */ |
|
48 ~CNSmlDmACLParser(); |
|
49 |
|
50 /** |
|
51 * Parses acl to structure |
|
52 * @param aACL Acl in descriptor |
|
53 * @return KErrNone if succesfully parsed |
|
54 */ |
|
55 TInt ParseL(const TDesC8& aACL); |
|
56 |
|
57 /** |
|
58 * Generates ACL from structure |
|
59 * @return Generated acl |
|
60 */ |
|
61 HBufC8* GenerateL(); |
|
62 |
|
63 /** |
|
64 * Removes all the references to server from acls |
|
65 * @param aServerId Server id to be removed from acls |
|
66 */ |
|
67 void RemoveAllReferences(const TDesC8& aServerId); |
|
68 |
|
69 /** |
|
70 * Check if current acl can be deleted. The Acl can be deleted if it is |
|
71 * empty, i.e. no references to any server in any command |
|
72 * @return ETrue if can be deleted |
|
73 */ |
|
74 TBool ShouldDelete(); |
|
75 |
|
76 /** |
|
77 * Check if server has access rights for certain command |
|
78 * @param aServerId Server id to be checked |
|
79 * @param aCommandType Type of command (add,...) |
|
80 * @return ETrue if access OK |
|
81 */ |
|
82 TBool HasRights(const TDesC8& aServerId,TNSmlDmCmdType aCommandType); |
|
83 |
|
84 private: |
|
85 void Reset(); |
|
86 CNSmlAclElement* iCommandAcls; |
|
87 }; |
|
88 |
|
89 /** |
|
90 * CNSmlAclElement is container class for one command in acls |
|
91 * |
|
92 * @since |
|
93 */ |
|
94 class CNSmlAclElement : public CBase |
|
95 { |
|
96 public: |
|
97 /** |
|
98 * Constructor |
|
99 */ |
|
100 CNSmlAclElement(); |
|
101 |
|
102 /** |
|
103 * Destructor |
|
104 */ |
|
105 virtual ~CNSmlAclElement(); |
|
106 |
|
107 /** |
|
108 * Type of command |
|
109 */ |
|
110 TNSmlDmCmdType iCommandType; |
|
111 |
|
112 /** |
|
113 * Array of server ids to one command |
|
114 */ |
|
115 RPointerArray<HBufC8> iServerIds; |
|
116 |
|
117 /** |
|
118 * True if all servers has access rigths, i.e acl value is * |
|
119 */ |
|
120 TBool iAllServers; |
|
121 |
|
122 /** |
|
123 * Pointer to next element |
|
124 */ |
|
125 CNSmlAclElement* iNext; |
|
126 }; |
|
127 |
|
128 |
|
129 |
|
130 #endif // __NSMLDMACLPARSER_H |