2 * AuthorizationDBPlist.h
5 * Created by Conrad Sauerwald on Tue Mar 18 2003.
6 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
9 #ifndef _H_AUTHORIZATIONDBPLIST
10 #define _H_AUTHORIZATIONDBPLIST 1
12 #include <CoreFoundation/CoreFoundation.h>
13 #include "AuthorizationData.h"
14 #include "AuthorizationRule.h"
16 namespace Authorization
19 class AuthorizationDBPlist
/* : public AuthorizationDB */
22 AuthorizationDBPlist(const char *configFile
= "/etc/authorization");
23 //~AuthorizationDBPlist();
25 void sync(CFAbsoluteTime now
);
26 bool validateRule(string inRightName
, CFDictionaryRef inRightDefinition
) const;
27 CFDictionaryRef
getRuleDefinition(string
&key
);
29 bool existRule(string
&ruleName
) const;
30 Rule
getRule(const AuthItemRef
&inRight
) const;
32 void setRule(const char *inRightName
, CFDictionaryRef inRuleDefinition
);
33 void removeRule(const char *inRightName
);
36 void load(CFTimeInterval now
);
43 enum { kTypeRight
, kTypeRule
};
44 void parseConfig(CFDictionaryRef config
);
45 static void parseRule(const void *key
, const void *value
, void *context
);
46 void addRight(CFStringRef key
, CFDictionaryRef definition
);
48 CFAbsoluteTime mLastChecked
;
49 struct timespec mRulesFileMtimespec
;
51 map
<string
,Rule
> mRules
;
52 CFRef
<CFDictionaryRef
> mConfig
;
53 CFRef
<CFMutableDictionaryRef
> mConfigRights
;
54 CFRef
<CFMutableDictionaryRef
> mConfigRules
;
56 mutable Mutex mLock
; // rule map lock
57 mutable Mutex mReadWriteLock
; // file operation lock
60 }; /* namespace Authorization */
62 #endif /* ! _H_AUTHORIZATIONDBPLIST */