def _get_modify_permission(cls, banner_id): banner = banner_client.get(banner_id) if not banner: raise_user_exc(BANNER_NOT_EXISTS_ERR, banner_id=banner_id) banner_regions = banner.regions if not banner_regions or not banner_regions.keys(): return True banner_city_ids = banner_regions.keys() if current_user.has_groups(['activity_manager', 'marketing_manager']): return True elif current_user.has_groups(['city_director']): user_city_ids = city_base.get_city_ids_by_user() return all([banner_city_id in user_city_ids for banner_city_id in banner_city_ids]) return False
def _get_current_user_relative_city_ids(): return get_city_ids_by_user() if current_user.is_super_admin( ) else get_marketman_relative_city_ids(current_user.id)
def _get_current_user_relative_city_ids(): return get_city_ids_by_user() if current_user.is_super_admin() else get_marketman_relative_city_ids(current_user.id)