当前位置: 首页>>代码示例>>Python>>正文


Python UserDao.get_all方法代码示例

本文整理汇总了Python中dao.UserDao.get_all方法的典型用法代码示例。如果您正苦于以下问题:Python UserDao.get_all方法的具体用法?Python UserDao.get_all怎么用?Python UserDao.get_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dao.UserDao的用法示例。


在下文中一共展示了UserDao.get_all方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_users

# 需要导入模块: from dao import UserDao [as 别名]
# 或者: from dao.UserDao import get_all [as 别名]
def get_users():
    current_user = get_current_user()
    result = []
    customers = assigneesHandler.get_customers(current_user.get('username'))
    if authentication.has_full_access(current_user):
        # super user, master admin
        result = [_set_customers(u) for u in UserDao.get_all()]
    elif authentication.user_is_master(current_user):
        if authentication.user_is_assigned_master(current_user):
            # master user (assigned master customer)
            users = [_set_customers(u) for u in UserDao.get_all()]
            result = [u for u in users if authentication.allow_semi_user_changes(u)]
        else:
            # master user (not assigned master customer)
            for customer in customers:
                assigned_users = assigneesHandler.get_assignees(customer.get('customer'))
                users = [get_user(a['user']) for a in assigned_users]
                result = result + [u for u in users if authentication.allow_semi_user_changes(u)]
    else:
        # can only be assigned to one..
        customer = customers[0]
        assigned_users = assigneesHandler.get_assignees(customer.get('customer'))
        users = [get_user(a['user']) for a in assigned_users]
        result = [u for u in users if u and authentication.allow_semi_user_changes(u)]
    return result
开发者ID:letterix,项目名称:rasp-temp,代码行数:27,代码来源:userHandler.py

示例2: test_005_onMessage_create_user_ok

# 需要导入模块: from dao import UserDao [as 别名]
# 或者: from dao.UserDao import get_all [as 别名]
    def test_005_onMessage_create_user_ok(self):
        num_users_before = len(UserDao.get_all())
        user_template = testData.USER_CREATE_OK
        user_data = json.loads(user_template['data'])
        SyncManager.onMessage(user_template)
        num_users_after = len(UserDao.get_all())

        user_created = UserDao.get_user(user_data['username'])
        self.assertEquals(num_users_after, num_users_before + 1)
        self.assertEquals(user_created['username'], user_data['username'])
开发者ID:letterix,项目名称:rasp-temp,代码行数:12,代码来源:sycManagerTest.py

示例3: test_006_onMessage_create_user_fail

# 需要导入模块: from dao import UserDao [as 别名]
# 或者: from dao.UserDao import get_all [as 别名]
 def test_006_onMessage_create_user_fail(self):
     num_users_before = len(UserDao.get_all())
     SyncManager.onMessage(testData.USER_CREATE_FAIL)
     num_users_after = len(UserDao.get_all())
     self.assertEquals(num_users_after, num_users_before)
开发者ID:letterix,项目名称:rasp-temp,代码行数:7,代码来源:sycManagerTest.py


注:本文中的dao.UserDao.get_all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。