--- /dev/null
+module AuthorizationHelper
+ include ActionView::Helpers::TranslationHelper
+
+ def authorization_scope(scope)
+ html = []
+ html << t("oauth.scopes.#{scope}")
+ if Oauth::MODERATOR_SCOPES.include? scope
+ html << " "
+ html << image_tag("roles/moderator.png", :srcset => image_path("roles/moderator.svg", :class => "align-text-bottom"), :size => "20x20")
+ end
+ safe_join(html)
+ end
+end
<td class="align-middle">
<ul class="list-unstyled mb-0">
<% application.scopes.each do |scope| -%>
- <li><%= t "oauth.scopes.#{scope}" %> <code class="text-muted">(<%= scope %>)</code></li>
+ <li><%= authorization_scope(scope) %> <code class="text-muted">(<%= scope %>)</code></li>
<% end -%>
</ul>
</td>
<ul>
<% @pre_auth.scopes.each do |scope| -%>
- <li><%= t "oauth.scopes.#{scope}" %></li>
+ <li><%= authorization_scope(scope) %></li>
<% end -%>
</ul>
<td class="align-middle">
<ul class="list-unstyled mb-0">
<% application.authorized_scopes_for(current_user).each do |scope| -%>
- <li><%= t "oauth.scopes.#{scope}" %></li>
+ <li><%= authorization_scope(scope) %></li>
<% end -%>
</ul>
</td>
module Oauth
SCOPES = %w[read_prefs write_prefs write_diary write_api read_gpx write_gpx write_notes].freeze
PRIVILEGED_SCOPES = %w[read_email skip_authorization].freeze
+ MODERATOR_SCOPES = %w[].freeze
OAUTH2_SCOPES = %w[openid].freeze
class Scope