<s> """<STR_LIT>""" <EOL> from django import template <EOL> from mdtui . security import SEC_GROUP_NAMES <EOL> register = template . Library ( ) <EOL> @ register . simple_tag ( takes_context = True ) <EOL> def check_search_permit ( context ) : <EOL> """<STR_LIT>""" <EOL> if '<STR_LIT>' in context : <EOL> return '<STR_LIT>' <EOL> user = context [ '<STR_LIT>' ] . user <EOL> permission = False <EOL> if not user . is_superuser : <EOL> groups = user . groups . all ( ) <EOL> for group in groups : <EOL> if group . name == SEC_GROUP_NAMES [ '<STR_LIT>' ] : <EOL> permission = True <EOL> else : <EOL> permission = True <EOL> context [ '<STR_LIT>' ] = permission <EOL> return '<STR_LIT>' <EOL> @ register . simple_tag ( takes_context = True ) <EOL> def check_index_permit ( context ) : <EOL> """<STR_LIT>""" <EOL> if '<STR_LIT>' in context : <EOL> return '<STR_LIT>' <EOL> user = context [ '<STR_LIT>' ] . user <EOL> permission = False <EOL> if not user . is_superuser : <EOL> groups = user . groups . all ( ) <EOL> for group in groups : <EOL> if group . name == SEC_GROUP_NAMES [ '<STR_LIT:index>' ] : <EOL> permission = True <EOL> else : <EOL> permission = True <EOL> context [ '<STR_LIT>' ] = permission <EOL> return '<STR_LIT>' <EOL> @ register . simple_tag ( takes_context = True ) <EOL> def check_edit_index_permit ( context ) : <EOL> """<STR_LIT>""" <EOL> if '<STR_LIT>' in context : <EOL> return '<STR_LIT>' <EOL> user = context [ '<STR_LIT>' ] . user <EOL> permission = False <EOL> if not user . is_superuser : <EOL> groups = user . groups . all ( ) <EOL> for group in groups : <EOL> if group . name == SEC_GROUP_NAMES [ '<STR_LIT>' ] : <EOL> permission = True <EOL> else : <EOL> permission = True <EOL> context [ '<STR_LIT>' ] = permission <EOL> return '<STR_LIT>' </s>
