Commit b3b22b7a241ab8844618c5d0e761391774ee9678

Authored by Felipe Bormann
1 parent 1aec42d8

modified permissions again

Showing 1 changed file with 3 additions and 3 deletions   Show diff stats
amadeus/permissions.py
... ... @@ -15,7 +15,7 @@ def has_category_permissions(user, category):
15 15 if user.is_staff:
16 16 return True
17 17  
18   - if category.coordinators.filter(id = user.id).exists():
  18 + if category and category.coordinators.filter(id = user.id).exists():
19 19 return True
20 20  
21 21 return False
... ... @@ -27,7 +27,7 @@ def has_category_permissions(user, category):
27 27 - Create Topic inside Subject
28 28 """
29 29 def has_subject_permissions(user, subject):
30   - if user.is_staff:
  30 + if user and user.is_staff:
31 31 return True
32 32  
33 33 if subject.professor and subject.professor.filter(id = user.id).exists():
... ... @@ -46,7 +46,7 @@ def has_subject_view_permissions(user, subject):
46 46 if has_subject_permissions(user, subject):
47 47 return True
48 48  
49   - if subject.students.filter(id = user.id).exists():
  49 + if subject and subject.students.filter(id = user.id).exists():
50 50 return True
51 51  
52 52 return False
... ...