• adminset 管理员认证


     def decorator(view_func):
            def _wrapped_view(request, *args, **kwargs):
                iUser = UserInfo.objects.get(username=request.user)
                # 判断用户如果是超级管理员则具有所有权限
                if not iUser.is_superuser:
                    if not iUser.role:  # 如果用户无角色,直接返回无权限
                        return HttpResponseRedirect(reverse('permission_deny'))
    					
    MariaDB [adminset]> select * from accounts_userinfo;
    +----+-------------------------------------------------------------------------------+---------------------+----------+-------------------+-----------+--------------+----------+---------+-----------+
    | id | password                                                                      | last_login          | username | email             | is_active | is_superuser | nickname | role_id | ldap_name |
    +----+-------------------------------------------------------------------------------+---------------------+----------+-------------------+-----------+--------------+----------+---------+-----------+
    |  1 | pbkdf2_sha256$36000$b0wLrovVzob2$Dvvix2zjid1DbJdkPjBkjncLeT8BlXuqj112HaqlSzk= | 2018-10-29 16:55:54 | 015208   | 015208@zjtlcb.com |         1 |            1 | NULL     |    NULL |           |
    |  2 | pbkdf2_sha256$36000$UYXP1ELpOvE5$DqkptuRi0izyorJMJBURQbKXxPWJHuPMLHw/U0wIw1c= | 2018-10-29 16:44:10 | 015209   | 015209@zjtlcb.com |         1 |            0 | 015209   |       1 |           |
    +----+-------------------------------------------------------------------------------+---------------------+----------+-------------------+-----------+--------------+----------+---------+-----------+
    2 rows in set (0.00 sec)	
  • 相关阅读:
    不等式(一)-Markov与Chebyshev不等式
    决策树学习
    k-NN最近邻算法(k-nearest neighbors algorithm)
    梯度下降(Gradient Descent)数学原理分析与实例
    求解素数
    shell基础命令使用
    安装jenkins
    idea拉取git
    shell常用命令
    linux 安装jdk
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349002.html
Copyright © 2020-2023  润新知