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


Python SSUser.readByName方法代码示例

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


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

示例1: read

# 需要导入模块: from server.models.ssuser import SSUser [as 别名]
# 或者: from server.models.ssuser.SSUser import readByName [as 别名]
 def read(self, userName):
     theUser = SSUser.readByName(userName)
     if not theUser:
         return error("User %s does not exist" % userName, UserDoesNotExistError)
     loggedInUser = SSUser.read(helper.getLoggedInUser())
     canReadFull = loggedInUser.canReadFull(theUser)
     return data(theUser.toDict((loggedInUser and canReadFull)))
开发者ID:gmatters,项目名称:shiftspace,代码行数:9,代码来源:user.py

示例2: groups

# 需要导入模块: from server.models.ssuser import SSUser [as 别名]
# 或者: from server.models.ssuser.SSUser import readByName [as 别名]
 def groups(self, userName, start=None, end=None, limit=25):
     loggedInUser = helper.getLoggedInUser()
     theUser = SSUser.read(loggedInUser)
     otherUser = SSUser.readByName(userName)
     if loggedInUser == otherUser.id or theUser.isAdmin():
         return data(otherUser.groups(start=start, end=end, limit=limit))
     else:
         return error("You don't have permission to view this user's groups.", PermissionError)
开发者ID:gmatters,项目名称:shiftspace,代码行数:10,代码来源:user.py

示例3: unreadCount

# 需要导入模块: from server.models.ssuser import SSUser [as 别名]
# 或者: from server.models.ssuser.SSUser import readByName [as 别名]
 def unreadCount(self, userName):
     loggedInUser = helper.getLoggedInUser()
     theUser = SSUser.read(loggedInUser)
     otherUser = SSUser.readByName(userName)
     if loggedInUser == otherUser.id or theUser.isAdmin():
         return data(theUser.unreadCount())
     else:
         return error("You do not have permission to view this user's unread count.", PermissionError)
开发者ID:gmatters,项目名称:shiftspace,代码行数:10,代码来源:user.py

示例4: unfollow

# 需要导入模块: from server.models.ssuser import SSUser [as 别名]
# 或者: from server.models.ssuser.SSUser import readByName [as 别名]
 def unfollow(self, userName):
     theUser = SSUser.read(helper.getLoggedInUser())
     followed = SSUser.readByName(userName)
     if theUser.id == followed.id:
         return error("You cannot unfollow yourself.", FollowError)
     else:
         theUser.unfollow(followed)
         return data(followed)
开发者ID:gmatters,项目名称:shiftspace,代码行数:10,代码来源:user.py

示例5: update

# 需要导入模块: from server.models.ssuser import SSUser [as 别名]
# 或者: from server.models.ssuser.SSUser import readByName [as 别名]
 def update(self, userName):
     theUser = SSUser.readByName(userName)
     if not theUser:
         return error("User %s does not exist" % userName, UserDoesNotExistError)
     loggedInUser = SSUser.read(helper.getLoggedInUser())
     if loggedInUser and loggedInUser.canModify(theUser):
         theData = json.loads(helper.getRequestBody())
         return data(theUser.update(theData))
     else:
         return error("Operation not permitted. You don't have permission to update this account.")
开发者ID:gmatters,项目名称:shiftspace,代码行数:12,代码来源:user.py

示例6: delete

# 需要导入模块: from server.models.ssuser import SSUser [as 别名]
# 或者: from server.models.ssuser.SSUser import readByName [as 别名]
 def delete(self, userName):
     theUser = SSUser.readByName(userName)
     if not theUser:
         return error("User %s does not exist" % userName, UserDoesNotExistError)
     loggedInUser = SSUser.read(helper.getLoggedInUser())
     if loggedInUser and loggedInUser.canModify(theUser):
         if theUser.id == loggedInUser.id:
             helper.setLoggedInUser(None)
         theUser.delete()
         return ack
     else:
         return error("Operation not permitted. You don't have permission to delete this account.")
开发者ID:gmatters,项目名称:shiftspace,代码行数:14,代码来源:user.py

示例7: shifts

# 需要导入模块: from server.models.ssuser import SSUser [as 别名]
# 或者: from server.models.ssuser.SSUser import readByName [as 别名]
 def shifts(self, userName, start=None, end=None, limit=25, filter=False, query=None):
     loggedInUser = helper.getLoggedInUser()
     theUser = SSUser.read(loggedInUser)
     otherUser = SSUser.readByName(userName)
     if query != None:
         query = json.loads(query)
     if loggedInUser == otherUser.id or theUser.isAdmin():
         return data(otherUser.shifts(start=start,
                                      end=end,
                                      limit=limit,
                                      filter=filter,
                                      query=query))
     else:
         return error("You don't have permission to view this user's shifts.", PermissionError)
开发者ID:gmatters,项目名称:shiftspace,代码行数:16,代码来源:user.py

示例8: login

# 需要导入模块: from server.models.ssuser import SSUser [as 别名]
# 或者: from server.models.ssuser.SSUser import readByName [as 别名]
 def login(self, userName, password):
     loggedInUser = helper.getLoggedInUser()
     if not loggedInUser:
         theUser = SSUser.readByName(userName)
         if not theUser:
             return error("Invalid user name.", InvalidUserNameError)
         if theUser and (theUser.password == md5hash(password)):
             helper.setLoggedInUser(theUser.id)
             # TODO: perhaps don't update yet, might want to use for unread counts - David
             theUser.updateLastSeen()
             return data(theUser)
         else:
             return error("Incorrect password.", IncorrectPasswordError)
     else:
         return error("Already logged in.", AlreadyLoggedInError)
开发者ID:gmatters,项目名称:shiftspace,代码行数:17,代码来源:user.py

示例9: resolveResource

# 需要导入模块: from server.models.ssuser import SSUser [as 别名]
# 或者: from server.models.ssuser.SSUser import readByName [as 别名]
 def resolveResource(self, userName):
     theUser = SSUser.readByName(userName)
     return (theUser and theUser.id)
开发者ID:gmatters,项目名称:shiftspace,代码行数:5,代码来源:user.py

示例10: info

# 需要导入模块: from server.models.ssuser import SSUser [as 别名]
# 或者: from server.models.ssuser.SSUser import readByName [as 别名]
 def info(self, userName):
     theUser = SSUser.readByName(userName)
     return data(theUser.info())
开发者ID:gmatters,项目名称:shiftspace,代码行数:5,代码来源:user.py


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