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)	
  • 相关阅读:
    语言基础
    进制转换
    Java基础相关
    Java基础了解
    php 条件查询和多条件查询
    php 增删改查练习
    php 用封装类的方法操作数据库和批量删除
    php 用面向对象的方法对数据库增删改查
    php 面向对象的方式访问数据库
    OOP 7大原则
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349002.html
Copyright © 2011-2022 走看看