Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
    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)
Ejemplo n.º 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)