# {py:mod}`ltiapi.utils`

```{py:module} ltiapi.utils
```

```{autodoc2-docstring} ltiapi.utils
:allowtitles:
```

## Module Contents

### Classes

````{list-table}
:class: autosummary longtable
:align: left

* - {py:obj}`Chain <ltiapi.utils.Chain>`
  - ```{autodoc2-docstring} ltiapi.utils.Chain
    :summary:
    ```
````

### Functions

````{list-table}
:class: autosummary longtable
:align: left

* - {py:obj}`chain <ltiapi.utils.chain>`
  - ```{autodoc2-docstring} ltiapi.utils.chain
    :summary:
    ```
* - {py:obj}`build_absolute_uri_without_request <ltiapi.utils.build_absolute_uri_without_request>`
  - ```{autodoc2-docstring} ltiapi.utils.build_absolute_uri_without_request
    :summary:
    ```
* - {py:obj}`generate_key_pair <ltiapi.utils.generate_key_pair>`
  - ```{autodoc2-docstring} ltiapi.utils.generate_key_pair
    :summary:
    ```
* - {py:obj}`keys_for_issuer <ltiapi.utils.keys_for_issuer>`
  - ```{autodoc2-docstring} ltiapi.utils.keys_for_issuer
    :summary:
    ```
* - {py:obj}`make_tool_config_from_openid_config_via_link <ltiapi.utils.make_tool_config_from_openid_config_via_link>`
  - ```{autodoc2-docstring} ltiapi.utils.make_tool_config_from_openid_config_via_link
    :summary:
    ```
* - {py:obj}`lti_registration_data <ltiapi.utils.lti_registration_data>`
  - ```{autodoc2-docstring} ltiapi.utils.lti_registration_data
    :summary:
    ```
* - {py:obj}`get_launch_url <ltiapi.utils.get_launch_url>`
  - ```{autodoc2-docstring} ltiapi.utils.get_launch_url
    :summary:
    ```
* - {py:obj}`get_roles <ltiapi.utils.get_roles>`
  - ```{autodoc2-docstring} ltiapi.utils.get_roles
    :summary:
    ```
* - {py:obj}`is_superior <ltiapi.utils.is_superior>`
  - ```{autodoc2-docstring} ltiapi.utils.is_superior
    :summary:
    ```
* - {py:obj}`get_message_data <ltiapi.utils.get_message_data>`
  - ```{autodoc2-docstring} ltiapi.utils.get_message_data
    :summary:
    ```
* - {py:obj}`get_lti_tool <ltiapi.utils.get_lti_tool>`
  - ```{autodoc2-docstring} ltiapi.utils.get_lti_tool
    :summary:
    ```
* - {py:obj}`get_lms <ltiapi.utils.get_lms>`
  - ```{autodoc2-docstring} ltiapi.utils.get_lms
    :summary:
    ```
* - {py:obj}`get_course_from_launch_data <ltiapi.utils.get_course_from_launch_data>`
  - ```{autodoc2-docstring} ltiapi.utils.get_course_from_launch_data
    :summary:
    ```
* - {py:obj}`get_user_from_launch_data <ltiapi.utils.get_user_from_launch_data>`
  - ```{autodoc2-docstring} ltiapi.utils.get_user_from_launch_data
    :summary:
    ```
````

### Data

````{list-table}
:class: autosummary longtable
:align: left

* - {py:obj}`ChainedObj <ltiapi.utils.ChainedObj>`
  - ```{autodoc2-docstring} ltiapi.utils.ChainedObj
    :summary:
    ```
* - {py:obj}`user_transform <ltiapi.utils.user_transform>`
  - ```{autodoc2-docstring} ltiapi.utils.user_transform
    :summary:
    ```
* - {py:obj}`ROLE_START <ltiapi.utils.ROLE_START>`
  - ```{autodoc2-docstring} ltiapi.utils.ROLE_START
    :summary:
    ```
* - {py:obj}`CLAIM <ltiapi.utils.CLAIM>`
  - ```{autodoc2-docstring} ltiapi.utils.CLAIM
    :summary:
    ```
````

### API

````{py:data} ChainedObj
:canonical: ltiapi.utils.ChainedObj
:value: >
   None

```{autodoc2-docstring} ltiapi.utils.ChainedObj
```

````

`````{py:class} Chain(obj: ltiapi.utils.ChainedObj)
:canonical: ltiapi.utils.Chain

Bases: {py:obj}`typing.Generic`\[{py:obj}`ltiapi.utils.ChainedObj`\]

```{autodoc2-docstring} ltiapi.utils.Chain
```

```{rubric} Initialization
```

```{autodoc2-docstring} ltiapi.utils.Chain.__init__
```

````{py:method} get(key: typing.Any, default=None)
:canonical: ltiapi.utils.Chain.get

```{autodoc2-docstring} ltiapi.utils.Chain.get
```

````

````{py:attribute} __getitem__
:canonical: ltiapi.utils.Chain.__getitem__
:value: >
   None

```{autodoc2-docstring} ltiapi.utils.Chain.__getitem__
```

````

````{py:method} __call__() -> ltiapi.utils.ChainedObj
:canonical: ltiapi.utils.Chain.__call__

```{autodoc2-docstring} ltiapi.utils.Chain.__call__
```

````

`````

````{py:function} chain(obj: typing.Any, members: typing.Sequence[typing.Any], default=None)
:canonical: ltiapi.utils.chain

```{autodoc2-docstring} ltiapi.utils.chain
```
````

````{py:function} build_absolute_uri_without_request(url: str, query: str = '', host: str = settings.LINK_BASE, protocol: typing.Optional[str] = 'https')
:canonical: ltiapi.utils.build_absolute_uri_without_request

```{autodoc2-docstring} ltiapi.utils.build_absolute_uri_without_request
```
````

````{py:function} generate_key_pair(key_size=4096)
:canonical: ltiapi.utils.generate_key_pair
:async:

```{autodoc2-docstring} ltiapi.utils.generate_key_pair
```
````

````{py:function} keys_for_issuer(issuer_name: str) -> pylti1p3.contrib.django.lti1p3_tool_config.models.LtiToolKey
:canonical: ltiapi.utils.keys_for_issuer
:async:

```{autodoc2-docstring} ltiapi.utils.keys_for_issuer
```
````

````{py:function} make_tool_config_from_openid_config_via_link(openid_config: typing.Dict[str, typing.Any], openid_registration: typing.Dict[str, typing.Any], one_off_registration: ltiapi.models.OneOffRegistrationLink)
:canonical: ltiapi.utils.make_tool_config_from_openid_config_via_link
:async:

```{autodoc2-docstring} ltiapi.utils.make_tool_config_from_openid_config_via_link
```
````

````{py:function} lti_registration_data(request: django.http.HttpRequest)
:canonical: ltiapi.utils.lti_registration_data

```{autodoc2-docstring} ltiapi.utils.lti_registration_data
```
````

````{py:function} get_launch_url(request: django.http.HttpRequest)
:canonical: ltiapi.utils.get_launch_url

```{autodoc2-docstring} ltiapi.utils.get_launch_url
```
````

````{py:data} user_transform
:canonical: ltiapi.utils.user_transform
:value: >
   None

```{autodoc2-docstring} ltiapi.utils.user_transform
```

````

````{py:data} ROLE_START
:canonical: ltiapi.utils.ROLE_START
:value: >
   'http://purl.imsglobal.org/vocab/lis/v2/'

```{autodoc2-docstring} ltiapi.utils.ROLE_START
```

````

````{py:function} get_roles(message_launch_data: dict) -> typing.List[django.contrib.auth.models.Group]
:canonical: ltiapi.utils.get_roles

```{autodoc2-docstring} ltiapi.utils.get_roles
```
````

````{py:function} is_superior(user: ltiapi.models.LTIUser) -> bool
:canonical: ltiapi.utils.is_superior

```{autodoc2-docstring} ltiapi.utils.is_superior
```
````

````{py:data} CLAIM
:canonical: ltiapi.utils.CLAIM
:value: >
   'https://purl.imsglobal.org/spec/lti/claim'

```{autodoc2-docstring} ltiapi.utils.CLAIM
```

````

````{py:function} get_message_data(message_launch_data: dict, data: str)
:canonical: ltiapi.utils.get_message_data

```{autodoc2-docstring} ltiapi.utils.get_message_data
```
````

````{py:function} get_lti_tool(tool_conf: pylti1p3.contrib.django.lti1p3_tool_config.DjangoDbToolConf, message_launch_data: dict) -> dict
:canonical: ltiapi.utils.get_lti_tool

```{autodoc2-docstring} ltiapi.utils.get_lti_tool
```
````

````{py:function} get_lms(message_launch_data: dict)
:canonical: ltiapi.utils.get_lms

```{autodoc2-docstring} ltiapi.utils.get_lms
```
````

````{py:function} get_course_from_launch_data(message_launch_data: dict) -> ltiapi.models.Course
:canonical: ltiapi.utils.get_course_from_launch_data

```{autodoc2-docstring} ltiapi.utils.get_course_from_launch_data
```
````

````{py:function} get_user_from_launch_data(message_launch_data: dict, lti_tool: pylti1p3.contrib.django.lti1p3_tool_config.models.LtiTool) -> ltiapi.models.LTIUser
:canonical: ltiapi.utils.get_user_from_launch_data

```{autodoc2-docstring} ltiapi.utils.get_user_from_launch_data
```
````
