aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/oauth.ex
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2019-02-14 00:29:29 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2019-02-14 00:29:29 +0300
commit063baca5e4f3a100c0d45dffb14e4968599ef43b (patch)
tree007c44ff7cd2c90b2e1c18d7ced704448fea5601 /lib/pleroma/web/oauth.ex
parenta337bd114c3cbbb8e8270ec56a012e82f84df808 (diff)
downloadpleroma-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.ex19
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