CAT-SOOP API: catsoop.auth

User authentication for normal interactions

View Source

Members

  • catsoop.auth.get_auth_type (function, lines 38-51)

    Return the methods associated with the currently chosen authentication type.

    Parameters:

    • context: the context associated with this request.

    Returns: a dictionary containing the variables defined in the authentication type specified by context['cs_auth_type'].

 

  • catsoop.auth.get_auth_type_by_name (function, lines 54-79)

    Helper function. Returns the methods associated with the given authentication type, regardless of which is active.

    Parameters:

    • context: the context associated with this request.
    • auth_type: the name of the authentication type in question.

    Returns: a dictionary containing the variables defined in the authentication type specified by auth_type.

 

  • catsoop.auth.get_logged_in_user (function, lines 82-117)

    From the context, get information about the logged in user.

    If the context has an API token in it, that value will be used to determine who is logged in. Otherwise, the currently-active authentication type's get_logged_in_user function is used.

    Side effect: if the user in question does not have an API token already, a new one is created for them.

    Parameters:

    • context: the context associated with this request

    Returns: a dictionary containing the information associated with the user who is currently logged in. If a user is logged in, it will contain some subset of the keys 'username', 'name', and 'email'.

 

  • catsoop.auth.get_user_information (function, lines 120-144)

    Based on the context, load extra information about the user who is logged in.

    This method is used to load any information specified about the user in a course's __USERS__ directory, or from a global log. For example, course-level permissions are loaded this way.

    This function is also responsible for handling impersonation of other users.

    Parameters:

    • context: the context associated with this request

    Returns: a dictionary like that returned by get_logged_in_user, but (possibly) with additional mappings as specified in the loaded file.