def wrapped_function(*args, **kwargs): git_revision = subprocess.check_output( ['git', 'rev-parse', '--short', 'HEAD']).decode('utf-8').rstrip() uuid = str(session["userinfo"].get("sub", "")) uid = str(session["userinfo"].get("preferred_username", "")) user_obj = _ldap.get_member(uid, uid=True) info = { "git_revision": git_revision, "uuid": uuid, "uid": uid, "user_obj": user_obj, "member_info": get_member_info(uid), "color": requests.get( 'https://themeswitcher.csh.rit.edu/api/colour').content, "current_year": parse_account_year(str(datetime.datetime.now().strftime("%Y%m"))), "rtp": ldap_is_rtp(user_obj) } kwargs["info"] = info return func(*args, **kwargs)
def clear_cache(info=None): if not ldap_is_rtp(info['user_obj']): return redirect("/") ldap_get_active_members.cache_clear() ldap_get_intro_members.cache_clear() ldap_get_onfloor_members.cache_clear() ldap_get_current_students.cache_clear() ldap_get_all_members.cache_clear() ldap_get_groups.cache_clear() ldap_get_group_desc.cache_clear() ldap_get_eboard.cache_clear() ldap_search_members.cache_clear() ldap_get_year.cache_clear() get_image.cache_clear() get_gravatar.cache_clear() proxy_image.cache_clear() flash('Cache cleared!') return redirect(request.referrer, 302)