@@ -18,26 +18,27 @@ def check_access(user):
1818 This function takes a Django User object and returns true if the user has access to
1919 the Announcement app.
2020 '''
21- person = user .person
22- groups_with_access = ("iab" , "isoc" , "isocbot" , "rsoc" , "ietf" , "iaoc" , "rse" , "mentor" ,"ietf-trust" )
23- if Role .objects .filter (person = person ,
24- group__acronym__in = groups_with_access ,
25- name = "chair" ) or has_role (user , ["Secretariat" ,"IAD" ]):
26- return True
27- if Role .objects .filter (name = "chair" ,
28- group__acronym__startswith = "nomcom" ,
29- group__state = "active" ,
30- group__type = "nomcom" ,
31- person = person ):
32- return True
33- if Role .objects .filter (person = person ,
34- group__acronym = 'iab' ,
35- name = 'execdir' ):
36- return True
37- if Role .objects .filter (person = person ,
38- group__acronym = 'isoc' ,
39- name = 'ceo' ):
40- return True
21+ if hasattr (user , "person" ):
22+ person = user .person
23+ groups_with_access = ("iab" , "isoc" , "isocbot" , "rsoc" , "ietf" , "iaoc" , "rse" , "mentor" ,"ietf-trust" )
24+ if Role .objects .filter (person = person ,
25+ group__acronym__in = groups_with_access ,
26+ name = "chair" ) or has_role (user , ["Secretariat" ,"IAD" ]):
27+ return True
28+ if Role .objects .filter (name = "chair" ,
29+ group__acronym__startswith = "nomcom" ,
30+ group__state = "active" ,
31+ group__type = "nomcom" ,
32+ person = person ):
33+ return True
34+ if Role .objects .filter (person = person ,
35+ group__acronym = 'iab' ,
36+ name = 'execdir' ):
37+ return True
38+ if Role .objects .filter (person = person ,
39+ group__acronym = 'isoc' ,
40+ name = 'ceo' ):
41+ return True
4142
4243 return False
4344
0 commit comments