#NEWLINE# @ with_session #NEWLINE# def is_admin( self , user_login ) : #NEWLINE# #INDENT# user = _current . session . query ( model . DbUser ) . filter_by ( login = user_login ) . options ( joinedload ( 'role' ) ) . first ( ) #NEWLINE# if ( user . role . name in ( 'administrator' , 'admin' ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# first_admin_permission = _current . session . query ( model . DbUserPermission ) . filter_by ( user = user , permission_type = permissions . ADMIN_PANEL_ACCESS ) . first ( ) #NEWLINE# if ( first_admin_permission is not None ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# group_ids = [ user . id for group in user . groups ] #NEWLINE# if ( len ( group_ids ) > 0 ) : #NEWLINE# #INDENT# first_admin_permission = _current . session . query ( model . DbGroupPermission ) . filter ( model . DbGroupPermission . group_id . in_ ( group_ids ) , ( model . DbGroupPermission . permission_type == permissions . ADMIN_PANEL_ACCESS ) ) . first ( ) #NEWLINE# if ( first_admin_permission is not None ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# #UNINDENT# return False