本文整理汇总了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
示例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'])
示例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)