當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。