#NEWLINE# def get_user_calendars( user , permissions = [ 'viewer' ] ) : #NEWLINE# #INDENT# allowed_objects = set ( [ ] ) #NEWLINE# for perm in permissions : #NEWLINE# #INDENT# objects = get_allowed_objects ( user , ZornaCalendar , perm ) #NEWLINE# allowed_objects = allowed_objects . union ( set ( objects ) ) #NEWLINE# #UNINDENT# b_personal_calendar = SiteOptions . objects . is_access_valid ( user , 'zorna_personal_calendar' ) #NEWLINE# if b_personal_calendar : #NEWLINE# #INDENT# pcal = get_personal_calendar ( User . objects . get ( pk = user . pk ) ) #NEWLINE# allowed_objects . update ( [ pcal . pk ] ) #NEWLINE# #UNINDENT# communities = get_communities ( user ) #NEWLINE# for com in communities : #NEWLINE# #INDENT# if com . enable_calendar : #NEWLINE# #INDENT# cal = com . get_calendar ( ) #NEWLINE# allowed_objects . update ( [ cal . pk ] ) #NEWLINE# #UNINDENT# #UNINDENT# allowed_objects = ZornaCalendar . objects . filter ( pk__in = allowed_objects ) #NEWLINE# return allowed_objects