rebarre regionalisation
authorOlivier Larchevêque <olivier.larcheveque@auf.org>
Thu, 12 Jul 2012 16:10:16 +0000 (12:10 -0400)
committerOlivier Larchevêque <olivier.larcheveque@auf.org>
Thu, 12 Jul 2012 16:10:16 +0000 (12:10 -0400)
project/rh/admin.py

index f8ac5fa..6a90877 100644 (file)
@@ -17,8 +17,7 @@ from django.utils.formats import date_format
 from project import groups
 from project.decorators import in_drh_or_admin
 from project.rh import models as rh
 from project import groups
 from project.decorators import in_drh_or_admin
 from project.rh import models as rh
-from project.permissions import get_region_user,  \
-        user_gere_obj_de_sa_region, \
+from project.permissions import user_gere_obj_de_sa_region, \
         user_can_add_obj, \
         user_can_change_obj, \
         user_can_delete_obj
         user_can_add_obj, \
         user_can_change_obj, \
         user_can_delete_obj
@@ -134,22 +133,25 @@ class ProtectRegionMixin(object):
         if in_drh_or_admin(request.user):
             return qs
 
         if in_drh_or_admin(request.user):
             return qs
 
-        if user_gere_obj_de_sa_region(request.user):
-            region_user = get_region_user(request.user)
-            q = Q(**{self.model.prefix_implantation: \
-                    region_user})
-            qs = qs.filter(q).distinct()
-            return qs
+        #if user_gere_obj_de_sa_region(request.user):
+        #    region_user = get_region_user(request.user)
+        #    q = Q(**{self.model.prefix_implantation: \
+        #            region_user})
+        #    qs = qs.filter(q).distinct()
+        #    return qs
         return qs.none()
 
     def has_add_permission(self, request):
         return qs.none()
 
     def has_add_permission(self, request):
-        return user_can_add_obj(request.user)
+        return in_drh_or_admin(request.user)
+        #return user_can_add_obj(request.user)
 
     def has_change_permission(self, request, obj=None):
 
     def has_change_permission(self, request, obj=None):
-        return user_can_change_obj(request.user, obj) if obj else True
+        return in_drh_or_admin(request.user)
+        #return user_can_change_obj(request.user, obj) if obj else True
 
     def has_delete_permission(self, request, obj=None):
 
     def has_delete_permission(self, request, obj=None):
-        return user_can_delete_obj(request.user, obj) if obj else True
+        return in_drh_or_admin(request.user)
+        #return user_can_delete_obj(request.user, obj) if obj else True
 
 
 class DerniereModificationAdmin(admin.ModelAdmin):
 
 
 class DerniereModificationAdmin(admin.ModelAdmin):