entities/authobjs.py
branchtls-sprint
changeset 1398 5fe84a5f7035
parent 1343 659d3dc42e68
child 1553 3f91ef2397d0
--- a/entities/authobjs.py	Fri Apr 17 13:21:05 2009 +0200
+++ b/entities/authobjs.py	Fri Apr 17 16:55:37 2009 +0200
@@ -5,22 +5,23 @@
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 """
 __docformat__ = "restructuredtext en"
+
 from logilab.common.decorators import cached
 
 from cubicweb import Unauthorized
 from cubicweb.entities import AnyEntity, fetch_config
 
-class EGroup(AnyEntity):
-    id = 'EGroup'
+class CWGroup(AnyEntity):
+    id = 'CWGroup'
     fetch_attrs, fetch_order = fetch_config(['name'])
     fetch_unrelated_order = fetch_order
 
     def db_key_name(self):
         """XXX goa specific"""
         return self.get('name')
-    
-class EUser(AnyEntity):
-    id = 'EUser'
+
+class CWUser(AnyEntity):
+    id = 'CWUser'
     fetch_attrs, fetch_order = fetch_config(['login', 'firstname', 'surname'])
     fetch_unrelated_order = fetch_order
     
@@ -31,7 +32,7 @@
     def __init__(self, *args, **kwargs):
         groups = kwargs.pop('groups', None)
         properties = kwargs.pop('properties', None)
-        super(EUser, self).__init__(*args, **kwargs)
+        super(CWUser, self).__init__(*args, **kwargs)
         if groups is not None:
             self._groups = groups
         if properties is not None:
@@ -91,7 +92,7 @@
     def owns(self, eid):
         if hasattr(self.req, 'unsafe_execute'):
             # use unsafe_execute on the repository side, in case
-            # session's user doesn't have access to EUser
+            # session's user doesn't have access to CWUser
             execute = self.req.unsafe_execute
         else:
             execute = self.req.execute
@@ -103,7 +104,7 @@
     owns = cached(owns, keyarg=1)
 
     def has_permission(self, pname, contexteid=None):
-        rql = 'Any P WHERE P is EPermission, U eid %(u)s, U in_group G, '\
+        rql = 'Any P WHERE P is CWPermission, U eid %(u)s, U in_group G, '\
               'P name %(pname)s, P require_group G'
         kwargs = {'pname': pname, 'u': self.eid}
         cachekey = None
@@ -138,5 +139,5 @@
         return self.get('login')
 
 from logilab.common.deprecation import class_renamed
-Euser = class_renamed('Euser', EUser)
-Euser.id = 'Euser'
+EUser = class_renamed('EUser', CWUser)
+EGroup = class_renamed('EGroup', CWGroup)