AutoApi.Permissions (auto_api v13.2.0) View Source
Handles the conversion of AutoApi permissions between text and binary format
Link to this section Summary
Functions
Converts the list of scope-formatted permissions into their human readable equivalent
Parses permissions from a single comma-delimited string to a list
Returns available permissions
Converts a list of scope-formatted permissions into their binary equivalent
Verifies that all permissions are valid car permissions
Link to this section Functions
Converts the list of scope-formatted permissions into their human readable equivalent
Examples
iex> AutoApi.Permissions.format ["car.full_control"] ["full control of the car"]
iex> AutoApi.Permissions.parse("charge.read,lights.read,climate.write") ...> |> AutoApi.Permissions.format ["Allowed to get the charge state", "Allowed to get the lights state", "Allowed to set climate profile and start/stop HVAC"]
Parses permissions from a single comma-delimited string to a list
Examples
iex> AutoApi.Permissions.parse "charge.read,lights.read,climate.write" ["charge.read", "lights.read", "climate.write"]
Returns available permissions
Converts a list of scope-formatted permissions into their binary equivalent
Examples
iex> AutoApi.Permissions.to_binary ["charge.read", "lights.read", "climate.write"] 0x100000C8000000000000000000000000
iex> AutoApi.Permissions.to_binary ["car.full_control"] 0x1007FFFDFFEFFFFFFFFF1F0000000000
iex> AutoApi.Permissions.parse("charge.read,lights.read,climate.write") ...> |> AutoApi.Permissions.to_binary 0x100000C8000000000000000000000000
iex> AutoApi.Permissions.parse("power-takeoff.read,tachograph.read") ...> |> AutoApi.Permissions.to_binary 0x10000000000000000080010000000000
Verifies that all permissions are valid car permissions
Examples
iex> AutoApi.Permissions.verify ["charge.read", "lights.read", "climate.write"] true
iex> AutoApi.Permissions.verify ["charge.read", "i.dont.exist"] false