diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-02-14 00:29:29 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-02-14 00:29:29 +0300 |
commit | 063baca5e4f3a100c0d45dffb14e4968599ef43b (patch) | |
tree | 007c44ff7cd2c90b2e1c18d7ced704448fea5601 /lib/pleroma/web/oauth.ex | |
parent | a337bd114c3cbbb8e8270ec56a012e82f84df808 (diff) | |
download | pleroma-063baca5e4f3a100c0d45dffb14e4968599ef43b.tar.gz |
[#468] User UI for OAuth permissions restriction. Standardized storage format for `scopes` fields, updated usages.
Diffstat (limited to 'lib/pleroma/web/oauth.ex')
-rw-r--r-- | lib/pleroma/web/oauth.ex | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/pleroma/web/oauth.ex b/lib/pleroma/web/oauth.ex index 44b83433e..761b80fde 100644 --- a/lib/pleroma/web/oauth.ex +++ b/lib/pleroma/web/oauth.ex @@ -3,9 +3,22 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth do - def parse_scopes(scopes) do + def parse_scopes(nil) do + nil + end + + def parse_scopes(scopes) when is_list(scopes) do scopes - |> to_string() - |> String.split([" ", ","]) + end + + def parse_scopes(scopes) do + scopes = + scopes + |> to_string() + |> String.trim() + + if scopes == "", + do: [], + else: String.split(scopes, [" ", ","]) end end |