How to use the ramp-database.ramp_database.tools._query.select_event_admin_by_instance function in ramp-database

To help you get started, we’ve selected a few ramp-database examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github paris-saclay-cds / ramp-board / ramp-database / ramp_database / tools / event.py View on Github external
def add_event_admin(session, event_name, user_name):
    """Add an administrator event.

    Parameters
    ----------
    session : :class:`sqlalchemy.orm.Session`
        The session to directly perform the operation on the database.
    event_name : str
        The event name.
    user_name : str
        The user name.
    """
    event = select_event_by_name(session, event_name)
    user = select_user_by_name(session, user_name)
    event_admin = select_event_admin_by_instance(session, event, user)
    if event_admin is None:
        event_admin = EventAdmin(event=event, admin=user)
        session.commit()
github paris-saclay-cds / ramp-board / ramp-database / ramp_database / tools / frontend.py View on Github external
"""Whether or not a user is administrator or administrate an event.

    Parameters
    ----------
    session : :class:`sqlalchemy.orm.Session`
        The session to directly perform the operation on the database.
    event_name : str
        The event name.
    user_name : str
        The user name.
    """
    event = select_event_by_name(session, event_name)
    user = select_user_by_name(session, user_name)
    if user.access_level == 'admin':
        return True
    event_admin = select_event_admin_by_instance(session, event, user)
    if event_admin is None:
        return False
    return True
github paris-saclay-cds / ramp-board / ramp-database / ramp_database / tools / event.py View on Github external
----------
    session : :class:`sqlalchemy.orm.Session`
        The session to directly perform the operation on the database.
    event_name : str
        The event name.
    user_name : str
        The user name.

    Returns
    -------
    event_admin : :class:`ramp_database.model.EventAdmin` or None
        The event/admin instance queried.
    """
    event = select_event_by_name(session, event_name)
    user = select_user_by_name(session, user_name)
    return select_event_admin_by_instance(session, event, user)