2019-02-09 07:09:08 -07:00
|
|
|
# Pleroma: A lightweight social networking server
|
|
|
|
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule Pleroma.Web.OAuth do
|
2019-02-13 14:29:29 -07:00
|
|
|
def parse_scopes(nil) do
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
def parse_scopes(scopes) when is_list(scopes) do
|
2019-02-09 07:09:08 -07:00
|
|
|
scopes
|
2019-02-13 14:29:29 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
def parse_scopes(scopes) do
|
|
|
|
scopes =
|
|
|
|
scopes
|
|
|
|
|> to_string()
|
|
|
|
|> String.trim()
|
|
|
|
|
|
|
|
if scopes == "",
|
|
|
|
do: [],
|
|
|
|
else: String.split(scopes, [" ", ","])
|
2019-02-09 07:09:08 -07:00
|
|
|
end
|
|
|
|
end
|