2019-02-09 14:09:08 +00: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 21:29:29 +00:00
|
|
|
def parse_scopes(nil) do
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
def parse_scopes(scopes) when is_list(scopes) do
|
2019-02-09 14:09:08 +00:00
|
|
|
scopes
|
2019-02-13 21:29:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def parse_scopes(scopes) do
|
|
|
|
scopes =
|
|
|
|
scopes
|
|
|
|
|> to_string()
|
|
|
|
|> String.trim()
|
|
|
|
|
|
|
|
if scopes == "",
|
|
|
|
do: [],
|
|
|
|
else: String.split(scopes, [" ", ","])
|
2019-02-09 14:09:08 +00:00
|
|
|
end
|
|
|
|
end
|