Made um.addUser/um.addGroup return um.User and um.Group instance.
authorFrédéric Jolliton <git@frederic.jolliton.com>
Wed, 25 Oct 2006 12:56:03 +0000 (12:56 +0000)
committerFrédéric Jolliton <git@frederic.jolliton.com>
Wed, 25 Oct 2006 12:56:03 +0000 (12:56 +0000)
rsbac/um.py

index 9723a80..5506db9 100644 (file)
@@ -106,7 +106,7 @@ def addUser( name , uid = None , password = None , ttl = None ) :
                                          byref( userEntry ) , password ,
                                          ttl ) )
     # Let's hope that there are no race conditions at this point.
-    return getUid( name )
+    return User( getUid( name ) )
 
 @export
 def addGroup( name , gid = None , password = None , ttl = None ) :
@@ -127,7 +127,7 @@ def addGroup( name , gid = None , password = None , ttl = None ) :
                                           byref( groupEntry ) , password ,
                                           ttl ) )
     # Let's hope that there are no race conditions at this point.
-    return getGid( name )
+    return Group( getGid( name ) )
 
 @export
 def addToGroups( uid , gid , ttl = None ) :
@@ -642,9 +642,9 @@ class UserGroups( object ) :
     def __repr__( self ) :
         return '<Groups for user %d: %s>' % ( self._uid , list( self ) or 'none' )
     def add( self , gid , ttl = None ) :
-        addToGroups( self._uid , gid , ttl )
+        addToGroups( self._uid , int( gid ) , ttl )
     def discard( self , gid ) :
-        removeFromGroups( self._uid , gid )
+        removeFromGroups( self._uid , int( gid ) )
     def clear( self ) :
         map( self.discard , self )