예제 #1
0
파일: cc_user.py 프로젝트: tarun911/camcops
 def user_exists(cls, req: "CamcopsRequest", username: str) -> bool:
     """
     Does a user exist with this username?
     """
     if not username:
         return False
     dbsession = req.dbsession
     return exists_orm(dbsession, cls, cls.username == username)
예제 #2
0
파일: cc_user.py 프로젝트: tarun911/camcops
    def is_user_locked_out(cls, req: "CamcopsRequest", username: str) -> bool:
        """
        Is the specified user locked out?

        Args:
            req: :class:`camcops_server.cc_modules.cc_request.CamcopsRequest`
            username: the user's username
        """
        dbsession = req.dbsession
        now = req.now_utc
        return exists_orm(dbsession, cls, cls.username == username,
                          cls.locked_until > now)
예제 #3
0
파일: models.py 프로젝트: emosyne/crate
    def opting_out(cls, session: Session, mpid: Union[int, str]) -> bool:
        """
        Is this patient opting out?

        Args:
            session: SQLAlchemy database session for the secret admin database
            mpid: MPID of the patient to test

        Returns:
            opting out?

        """
        return exists_orm(session, cls, cls.mpid == mpid)
예제 #4
0
 def group_exists(cls, dbsession: SqlASession, group_id: int) -> bool:
     """
     Does a particular group (specified by its integer ID) exist?
     """
     return exists_orm(dbsession, cls, cls.id == group_id)