about summary refs log tree commit diff
path: root/app/helpers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-03-01 16:48:58 +0100
committerGitHub <noreply@github.com>2022-03-01 16:48:58 +0100
commit50ea54b3ed125477656893a67d9f552bb53e8ba5 (patch)
tree2de909d2659dc46e90de9b60f0b6b660e074b0c2 /app/helpers
parent233f7e6174947c28ee2d388713c0a58ca9ebb21e (diff)
Change authorized applications page (#17656)
* Change authorized applications page

* Hide revoke button for superapps and suspended accounts

* Clean up db/schema.rb
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 36c66b7d1..c5d9bbc19 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -224,4 +224,19 @@ module ApplicationHelper
     content_tag(:script, json_escape(json).html_safe, id: 'initial-state', type: 'application/json')
     # rubocop:enable Rails/OutputSafety
   end
+
+  def grouped_scopes(scopes)
+    scope_parser      = ScopeParser.new
+    scope_transformer = ScopeTransformer.new
+
+    scopes.each_with_object({}) do |str, h|
+      scope = scope_transformer.apply(scope_parser.parse(str))
+
+      if h[scope.key]
+        h[scope.key].merge!(scope)
+      else
+        h[scope.key] = scope
+      end
+    end.values
+  end
 end