from functools import wraps
from flask import redirect , url_for , g , abort , flash
__all__ = [
 "login_required" ,
 "permission_required" ,
 ]
if 82 - 82: Iii1i
def login_required ( func ) :
 @ wraps ( func )
 def Ii ( * args , ** kwargs ) :
  if not hasattr ( g , "user" ) :
   return redirect ( url_for ( "wgcomm.web_login" ) )
  else :
   return func ( * args , ** kwargs )
   if 12 - 12: i111IiI1Iii1I / OoOo
 return Ii
 if 12 - 12: OOo0O0oOo0O . ooo0oOoooOOO0 * Ii1I111 + i1iiIII111
 if 29 - 29: iI + o00Oo - OOoOoo000O00 * Oo0Oo - ii1I1iII1I1I . i1I1IiIIiIi1
def permission_required ( permission ) :
 def oo0O000ooO ( func ) :
  @ wraps ( func )
  def Ii ( * args , ** kwargs ) :
   if hasattr ( g , "user" ) and g . user . has_permission ( permission ) :
    return func ( * args , ** kwargs )
   else :
    return abort ( 403 )
    if 98 - 98: IiiIIiii1 % iIi1ii1I1iI11
  return Ii
  if 55 - 55: I11II1Ii % iIi
 return oo0O000ooO
# dd678faae9ac167bc83abf78e5cb2f3f0688d3a3
