zoukankan      html  css  js  c++  java
  • 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)	
  • 相关阅读:
    linux shell 小技能
    Jenkins 2.60.x 2种发送邮件方式
    Linux wget 批量下载
    日语阅读-2-如何看“何々的”的用法
    日语阅读-1-如何看ほう的用法
    [日本语]初级语法
    Python基础
    Python基础(10)
    Python基础(8)
    Python基础(7)
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349002.html
Copyright © 2011-2022 走看看