def can_access_account(func):
 @wraps(func)
 def wrapper(*args, **kwargs):
  user = getattr(g, 'user', None)
  user_id = kwargs.get('user_id')
  get_object_or_404(UserModel, user_id)
  if (user and ((user.id == user_id) or user.is_staff)):
   return func(*args, **kwargs)
  else:
   raise PermissionDeniedError()
 return wrapper

def can_access_account ( func ) : @ wraps ( func ) def wrapper ( * args , ** kwargs ) : user = getattr ( g , 'user' , None ) user_id = kwargs . get ( 'user_id' ) get_object_or_404 ( UserModel , user_id ) if ( user and ( ( user . id == user_id ) or user . is_staff ) ) : return func ( * args , ** kwargs ) else : raise PermissionDeniedError ( ) return wrapper
check if user can access account information .