1.1 --- a/java/security/__init__.py Tue Dec 14 01:35:21 2004 +0100
1.2 +++ b/java/security/__init__.py Tue Dec 14 01:35:34 2004 +0100
1.3 @@ -0,0 +1,50 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +class AccessControlContext(object):
1.7 + def __init__(self):
1.8 + # NOTE: Python-only method.
1.9 + self.acc = None
1.10 + self.combiner = None
1.11 + self.context = None
1.12 + def init__acc_combiner(self, acc, combiner):
1.13 + self.acc = acc
1.14 + self.combiner = combiner
1.15 + self.context = None
1.16 + def init__context(self, context):
1.17 + self.acc = None
1.18 + self.combiner = None
1.19 + self.context = context
1.20 + def checkPermission(self, perm):
1.21 + # NOTE: Implement properly.
1.22 + pass
1.23 + checkPermission___java__security__Permission = checkPermission
1.24 + def equals(self, obj):
1.25 + return self.context == obj.context
1.26 + equals___java__lang__Object = equals
1.27 + def getDomainCombiner(self):
1.28 + return self.combiner
1.29 + getDomainCombiner___java__security__DomainCombiner = getDomainCombiner
1.30 + def hashCode(self):
1.31 + # NOTE: Using Python hash function.
1.32 + return hash(self)
1.33 + hashCode___ = hashCode
1.34 +
1.35 +setattr(AccessControlContext, "__init_____java__security__AccessControlContext___java__security__DomainCombiner",
1.36 + AccessControlContext.init__acc_combiner)
1.37 +setattr(AccessControlContext, "__init_____java__security__ProtectionDomain_array_", AccessControlContext.init__context)
1.38 +
1.39 +class AccessController(object):
1.40 + def checkPermission(perm):
1.41 + # NOTE: Implement properly.
1.42 + pass
1.43 + checkPermission___java__security__Permission = staticmethod(checkPermission)
1.44 + def doPrivileged(action, context=None):
1.45 + # NOTE: Implement properly.
1.46 + return action.run___()
1.47 + doPrivileged___java__security__PrivilegedAction = staticmethod(doPrivileged)
1.48 + doPrivileged___java__security__PrivilegedAction___java__security__AccessControlContext = staticmethod(doPrivileged)
1.49 + def getContext():
1.50 + # NOTE: Implement properly.
1.51 + return AccessControlContext()
1.52 +
1.53 +# vim: tabstop=4 expandtab shiftwidth=4