[CalendarServer-changes] [1641]
CalendarServer/trunk/twistedcaldav/directory
source_changes at macosforge.org
source_changes at macosforge.org
Tue Jul 3 12:59:13 PDT 2007
Revision: 1641
http://trac.macosforge.org/projects/calendarserver/changeset/1641
Author: cdaboo at apple.com
Date: 2007-07-03 12:59:13 -0700 (Tue, 03 Jul 2007)
Log Message:
-----------
Fix to make sure sodoers file is only read when it actually changes.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/directory/sudo.py
CalendarServer/trunk/twistedcaldav/directory/test/sudoers.plist
CalendarServer/trunk/twistedcaldav/directory/test/test_sudo.py
Added Paths:
-----------
CalendarServer/trunk/twistedcaldav/directory/test/sudoers2.plist
Modified: CalendarServer/trunk/twistedcaldav/directory/sudo.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/sudo.py 2007-07-02 23:30:50 UTC (rev 1640)
+++ CalendarServer/trunk/twistedcaldav/directory/sudo.py 2007-07-03 19:59:13 UTC (rev 1641)
@@ -64,9 +64,11 @@
self._accounts()
def _accounts(self):
+ self.plistFile.restat()
fileInfo = (self.plistFile.getmtime(), self.plistFile.getsize())
if fileInfo != self._fileInfo:
self._plist = readPlist(self.plistFile.path)
+ self._fileInfo = fileInfo
return self._plist
Modified: CalendarServer/trunk/twistedcaldav/directory/test/sudoers.plist
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/test/sudoers.plist 2007-07-02 23:30:50 UTC (rev 1640)
+++ CalendarServer/trunk/twistedcaldav/directory/test/sudoers.plist 2007-07-03 19:59:13 UTC (rev 1641)
@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
-<dict>
- <key>users</key>
- <array>
- <dict>
- <key>authorize-as</key>
- <dict>
- <key>allow</key>
- <true/>
- <key>principals</key>
- <array>
- <string>all</string>
- </array>
- </dict>
- <key>authorize-from</key>
+ <dict>
+ <key>users</key>
<array>
- <string>127.0.0.1</string>
+ <dict>
+ <key>authorize-as</key>
+ <dict>
+ <key>allow</key>
+ <true />
+ <key>principals</key>
+ <array>
+ <string>all</string>
+ </array>
+ </dict>
+ <key>authorize-from</key>
+ <array>
+ <string>127.0.0.1</string>
+ </array>
+ <key>password</key>
+ <string>alice</string>
+ <key>username</key>
+ <string>alice</string>
+ </dict>
</array>
- <key>password</key>
- <string>alice</string>
- <key>username</key>
- <string>alice</string>
- </dict>
- </array>
-</dict>
+ </dict>
</plist>
Added: CalendarServer/trunk/twistedcaldav/directory/test/sudoers2.plist
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/test/sudoers2.plist (rev 0)
+++ CalendarServer/trunk/twistedcaldav/directory/test/sudoers2.plist 2007-07-03 19:59:13 UTC (rev 1641)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+ <key>users</key>
+ <array>
+ <dict>
+ <key>authorize-as</key>
+ <dict>
+ <key>allow</key>
+ <true />
+ <key>principals</key>
+ <array>
+ <string>all</string>
+ </array>
+ </dict>
+ <key>authorize-from</key>
+ <array>
+ <string>127.0.0.1</string>
+ </array>
+ <key>password</key>
+ <string>alice</string>
+ <key>username</key>
+ <string>alice</string>
+ </dict>
+ <dict>
+ <key>authorize-as</key>
+ <dict>
+ <key>allow</key>
+ <true />
+ <key>principals</key>
+ <array>
+ <string>all</string>
+ </array>
+ </dict>
+ <key>authorize-from</key>
+ <array>
+ <string>127.0.0.1</string>
+ </array>
+ <key>password</key>
+ <string>bob</string>
+ <key>username</key>
+ <string>bob</string>
+ </dict>
+ </array>
+ </dict>
+</plist>
Modified: CalendarServer/trunk/twistedcaldav/directory/test/test_sudo.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/test/test_sudo.py 2007-07-02 23:30:50 UTC (rev 1640)
+++ CalendarServer/trunk/twistedcaldav/directory/test/test_sudo.py 2007-07-03 19:59:13 UTC (rev 1641)
@@ -23,6 +23,7 @@
from twistedcaldav.directory.sudo import SudoDirectoryService
plistFile = FilePath(os.path.join(os.path.dirname(__file__), "sudoers.plist"))
+plistFile2 = FilePath(os.path.join(os.path.dirname(__file__), "sudoers2.plist"))
class SudoTestCase(
twistedcaldav.directory.test.util.BasicTestCase,
@@ -35,8 +36,9 @@
recordTypes = set(('sudoers',))
recordType = 'sudoers'
- sudoers = {'alice': {'password': 'alice',},
- }
+ sudoers = {
+ 'alice': {'password': 'alice',},
+ }
locations = {}
@@ -65,3 +67,20 @@
record = service.recordWithShortName(self.recordType, 'bob')
self.failIf(record)
+
+ def test_recordChanges(self):
+ service = self.service()
+
+ record = service.recordWithShortName(self.recordType, 'alice')
+ self.assertEquals(record.password, 'alice')
+
+ record = service.recordWithShortName(self.recordType, 'bob')
+ self.failIf(record)
+
+ plistFile2.copyTo(self._plistFile)
+
+ record = service.recordWithShortName(self.recordType, 'alice')
+ self.assertEquals(record.password, 'alice')
+
+ record = service.recordWithShortName(self.recordType, 'bob')
+ self.assertEquals(record.password, 'bob')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070703/4b6d0f4e/attachment.html
More information about the calendarserver-changes
mailing list