models/api/_structures.py
def check_is_admin(self) -> bool:
        """Check if user is an admin or not.

        Args:
            log ([type], optional): [description]. Defaults to None.

        Returns:
            bool: [description]
        """
        route = self.get_current_route()

        user_data = _utils.get_logged_user()
        if user_data is not None:
            if user_data["role"] >= 9:
                return True
            else:
                self.warning("Wrong permission: %s is not an admin"%user_data)

        admin_password = self.conf.get("admin_password")
        if self["admin"] and admin_password is not None:
            if secure_lib.check_magic_code(self["admin"], admin_password):
                return True

        ip = request.remote_addr
        admins_ips = self.conf.get("admins")
        if admins_ips and (ip in admins_ips or "::ffff:%s" % ip in admins_ips):
            return True
        else:
            self.warning("Wrong permission: %s is not an admin"%ip)
        return False
Check if user is an admin or not.

        Args:
            log ([type], optional): [description]. Defaults to None.

        Returns:
            bool: [description]
        
Check if user is an admin or not.
Check if user is an admin or not .
def check_is_admin(self) -> bool:
        route = self.get_current_route()
        user_data = _utils.get_logged_user()
        if user_data is not None:
            if user_data["role"] >= 9:
                return True
            else:
                self.warning("Wrong permission: %s is not an admin"%user_data)
        admin_password = self.conf.get("admin_password")
        if self["admin"] and admin_password is not None:
            if secure_lib.check_magic_code(self["admin"], admin_password):
                return True
        ip = request.remote_addr
        admins_ips = self.conf.get("admins")
        if admins_ips and (ip in admins_ips or "::ffff:%s" % ip in admins_ips):
            return True
        else:
            self.warning("Wrong permission: %s is not an admin"%ip)
        return False
def check_is_admin ( self ) -> bool : route = self . get_current_route ( ) user_data = _utils . get_logged_user ( ) if user_data is not None : if user_data [ "role" ] >= 9 : return True else : self . warning ( "Wrong permission: %s is not an admin" % user_data ) admin_password = self . conf . get ( "admin_password" ) if self [ "admin" ] and admin_password is not None : if secure_lib . check_magic_code ( self [ "admin" ] , admin_password ) : return True ip = request . remote_addr admins_ips = self . conf . get ( "admins" ) if admins_ips and ( ip in admins_ips or "::ffff:%s" % ip in admins_ips ) : return True else : self . warning ( "Wrong permission: %s is not an admin" % ip ) return False
Check if user is an admin or not.
Check if user is an admin or not .
"""Check if user is an admin or not.

        Args:
            log ([type], optional): [description]. Defaults to None.

        Returns:
            bool: [description]
        """
None
bool
self
log
[description]. Defaults to None.
[ description ] . Defaults to None .
None