diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-07-05 09:33:44 +0200 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2022-07-05 09:33:44 +0200 |
commit | 92c06a111397e7f9da44db9942f61fd06e03b557 (patch) | |
tree | 310b3d0f6c7f161dbcb68aa907bda4562dddd3d8 /config | |
parent | 7cc76b823ab4dfeca684051a99dba8ea4ce1a8fc (diff) | |
parent | 44b2ee3485ba0845e5910cefcb4b1e2f84f34470 (diff) |
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `app/controllers/admin/base_controller.rb`: Minor conflict caused by glitch-soc's theming system. - `app/javascript/mastodon/initial_state.js`: Minor conflict caused by glitch-soc making use of max_toot_chars. - `app/models/form/admin_settings.rb`: Minor conflict caused by glitch-soc's theming system. - `app/models/trends.rb`: Minor conflict caused by glitch-soc having more granular notification settings for trends. - `app/views/admin/accounts/index.html.haml`: Minor conflict caused by glitch-soc's theming system. - `app/views/admin/instances/show.html.haml`: Minor conflict caused by glitch-soc's theming system. - `app/views/layouts/application.html.haml`: Minor conflict caused by glitch-soc's theming system. - `app/views/settings/preferences/notifications/show.html.haml`: Minor conflict caused by glitch-soc having more granular notification settings for trends. - `config/navigation.rb`: Minor conflict caused by glitch-soc having additional navigation items for the theming system while upstream slightly changed every line.
Diffstat (limited to 'config')
-rw-r--r-- | config/application.rb | 1 | ||||
-rw-r--r-- | config/locales/activerecord.en.yml | 9 | ||||
-rw-r--r-- | config/locales/en.yml | 85 | ||||
-rw-r--r-- | config/locales/simple_form.en.yml | 15 | ||||
-rw-r--r-- | config/navigation.rb | 85 | ||||
-rw-r--r-- | config/roles.yml | 35 | ||||
-rw-r--r-- | config/routes.rb | 13 |
7 files changed, 177 insertions, 66 deletions
diff --git a/config/application.rb b/config/application.rb index 24fa2a978..06360832c 100644 --- a/config/application.rb +++ b/config/application.rb @@ -44,6 +44,7 @@ require_relative '../lib/webpacker/helper_extensions' require_relative '../lib/rails/engine_extensions' require_relative '../lib/active_record/database_tasks_extensions' require_relative '../lib/active_record/batches' +require_relative '../lib/simple_navigation/item_extensions' Dotenv::Railtie.load diff --git a/config/locales/activerecord.en.yml b/config/locales/activerecord.en.yml index 720b0f5e3..daeed58b8 100644 --- a/config/locales/activerecord.en.yml +++ b/config/locales/activerecord.en.yml @@ -38,3 +38,12 @@ en: email: blocked: uses a disallowed e-mail provider unreachable: does not seem to exist + role_id: + elevated: cannot be higher than your current role + user_role: + attributes: + permissions_as_keys: + dangerous: include permissions that are not safe for the base role + elevated: cannot include permissions your current role does not possess + position: + elevated: cannot be higher than your current role diff --git a/config/locales/en.yml b/config/locales/en.yml index 91ae3a3bc..2cd4f45ac 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -83,10 +83,8 @@ en: posts_tab_heading: Posts posts_with_replies: Posts and replies roles: - admin: Admin bot: Bot group: Group - moderator: Mod unavailable: Profile unavailable unfollow: Unfollow admin: @@ -105,12 +103,17 @@ en: avatar: Avatar by_domain: Domain change_email: - changed_msg: Account email successfully changed! + changed_msg: Email successfully changed! current_email: Current email label: Change email new_email: New email submit: Change email title: Change email for %{username} + change_role: + changed_msg: Role successfully changed! + label: Change role + no_role: No role + title: Change role for %{username} confirm: Confirm confirmed: Confirmed confirming: Confirming @@ -154,6 +157,7 @@ en: active: Active all: All pending: Pending + silenced: Limited suspended: Suspended title: Moderation moderation_notes: Moderation notes @@ -161,6 +165,7 @@ en: most_recent_ip: Most recent IP no_account_selected: No accounts were changed as none were selected no_limits_imposed: No limits imposed + no_role_assigned: No role assigned not_subscribed: Not subscribed pending: Pending review perform_full_suspension: Suspend @@ -187,12 +192,7 @@ en: reset: Reset reset_password: Reset password resubscribe: Resubscribe - role: Permissions - roles: - admin: Administrator - moderator: Moderator - staff: Staff - user: User + role: Role search: Search search_same_email_domain: Other users with the same e-mail domain search_same_ip: Other users with the same IP @@ -649,6 +649,67 @@ en: unresolved: Unresolved updated_at: Updated view_profile: View profile + roles: + add_new: Add role + assigned_users: + one: "%{count} user" + other: "%{count} users" + categories: + administration: Administration + devops: Devops + invites: Invites + moderation: Moderation + special: Special + delete: Delete + description_html: With <strong>user roles</strong>, you can customize which functions and areas of Mastodon your users can access. + edit: Edit '%{name}' role + everyone: Default permissions + everyone_full_description_html: This is the <strong>base role</strong> affecting <strong>all users</strong>, even those without an assigned role. All other roles inherit permissions from it. + permissions_count: + one: "%{count} permission" + other: "%{count} permissions" + privileges: + administrator: Administrator + administrator_description: Users with this permission will bypass every permission + delete_user_data: Delete User Data + delete_user_data_description: Allows users to delete other users' data without delay + invite_users: Invite Users + invite_users_description: Allows users to invite new people to the server + manage_announcements: Manage Announcements + manage_announcements_description: Allows users to manage announcements on the server + manage_appeals: Manage Appeals + manage_appeals_description: Allows users to review appeals against moderation actions + manage_blocks: Manage Blocks + manage_blocks_description: Allows users to block e-mail providers and IP addresses + manage_custom_emojis: Manage Custom Emojis + manage_custom_emojis_description: Allows users to manage custom emojis on the server + manage_federation: Manage Federation + manage_federation_description: Allows users to block or allow federation with other domains, and control deliverability + manage_invites: Manage Invites + manage_invites_description: Allows users to browse and deactivate invite links + manage_reports: Manage Reports + manage_reports_description: Allows users to review reports and perform moderation actions against them + manage_roles: Manage Roles + manage_roles_description: Allows users to manage and assign roles below theirs + manage_rules: Manage Rules + manage_rules_description: Allows users to change server rules + manage_settings: Manage Settings + manage_settings_description: Allows users to change site settings + manage_taxonomies: Manage Taxonomies + manage_taxonomies_description: Allows users to review trending content and update hashtag settings + manage_user_access: Manage User Access + manage_user_access_description: Allows users to disable other users' two-factor authentication, change their e-mail address, and reset their password + manage_users: Manage Users + manage_users_description: Allows users to view other users' details and perform moderation actions against them + manage_webhooks: Manage Webhooks + manage_webhooks_description: Allows users to set up webhooks for administrative events + view_audit_log: View Audit Log + view_audit_log_description: Allows users to see a history of administrative actions on the server + view_dashboard: View Dashboard + view_dashboard_description: Allows users to access the dashboard and various metrics + view_devops: Devops + view_devops_description: Allows users to access Sidekiq and pgHero dashboards + title: Roles rules: add_new: Add rule delete: Delete @@ -701,9 +762,6 @@ en: deletion: desc_html: Allow anyone to delete their account title: Open account deletion - min_invite_role: - disabled: No one - title: Allow invitations by require_invite_text: desc_html: When registrations require manual approval, make the “Why do you want to join?” text input mandatory rather than optional title: Require new users to enter a reason to join @@ -716,9 +774,6 @@ en: show_known_fediverse_at_about_page: desc_html: When disabled, restricts the public timeline linked from the landing page to showing only local content title: Include federated content on unauthenticated public timeline page - show_staff_badge: - desc_html: Show a staff badge on a user page - title: Show staff badge site_description: desc_html: Introductory paragraph on the API. Describe what makes this Mastodon server special and anything else important. You can use HTML tags, in particular <code><a></code> and <code><em></code>. title: Server description diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index ea4f68562..932f34d82 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -96,6 +96,13 @@ en: name: You can only change the casing of the letters, for example, to make it more readable user: chosen_languages: When checked, only posts in selected languages will be displayed in public timelines + role: The role controls which permissions the user has + user_role: + color: Color to be used for the role throughout the UI, as RGB in hex format + highlighted: This makes the role publicly visible + name: Public name of the role, if role is set to be displayed as a badge + permissions_as_keys: Users with this role will have access to... + position: Higher role decides conflict resolution in certain situations webhook: events: Select events to send url: Where events will be sent to @@ -232,6 +239,14 @@ en: name: Hashtag trendable: Allow this hashtag to appear under trends usable: Allow posts to use this hashtag + user: + role: Role + user_role: + color: Badge color + highlighted: Display role as badge on user profiles + name: Name + permissions_as_keys: Permissions + position: Priority webhook: events: Enabled events url: Endpoint URL diff --git a/config/navigation.rb b/config/navigation.rb index 2a4bf2d39..7a1aee078 100644 --- a/config/navigation.rb +++ b/config/navigation.rb @@ -2,72 +2,73 @@ SimpleNavigation::Configuration.run do |navigation| navigation.items do |n| - n.item :web, safe_join([fa_icon('chevron-left fw'), t('settings.back')]), root_url + n.item :web, safe_join([fa_icon('chevron-left fw'), t('settings.back')]), root_path - n.item :profile, safe_join([fa_icon('user fw'), t('settings.profile')]), settings_profile_url, if: -> { current_user.functional? } do |s| - s.item :profile, safe_join([fa_icon('pencil fw'), t('settings.appearance')]), settings_profile_url - s.item :featured_tags, safe_join([fa_icon('hashtag fw'), t('settings.featured_tags')]), settings_featured_tags_url + n.item :profile, safe_join([fa_icon('user fw'), t('settings.profile')]), settings_profile_path, if: -> { current_user.functional? } do |s| + s.item :profile, safe_join([fa_icon('pencil fw'), t('settings.appearance')]), settings_profile_path + s.item :featured_tags, safe_join([fa_icon('hashtag fw'), t('settings.featured_tags')]), settings_featured_tags_path end - n.item :preferences, safe_join([fa_icon('cog fw'), t('settings.preferences')]), settings_preferences_url, if: -> { current_user.functional? } do |s| - s.item :appearance, safe_join([fa_icon('desktop fw'), t('settings.appearance')]), settings_preferences_appearance_url - s.item :notifications, safe_join([fa_icon('bell fw'), t('settings.notifications')]), settings_preferences_notifications_url - s.item :other, safe_join([fa_icon('cog fw'), t('preferences.other')]), settings_preferences_other_url + n.item :preferences, safe_join([fa_icon('cog fw'), t('settings.preferences')]), settings_preferences_path, if: -> { current_user.functional? } do |s| + s.item :appearance, safe_join([fa_icon('desktop fw'), t('settings.appearance')]), settings_preferences_appearance_path + s.item :notifications, safe_join([fa_icon('bell fw'), t('settings.notifications')]), settings_preferences_notifications_path + s.item :other, safe_join([fa_icon('cog fw'), t('preferences.other')]), settings_preferences_other_path end - n.item :flavours, safe_join([fa_icon('paint-brush fw'), t('settings.flavours')]), settings_flavours_url do |flavours| + n.item :flavours, safe_join([fa_icon('paint-brush fw'), t('settings.flavours')]), settings_flavours_path do |flavours| Themes.instance.flavours.each do |flavour| - flavours.item flavour.to_sym, safe_join([fa_icon('star fw'), t("flavours.#{flavour}.name", default: flavour)]), settings_flavour_url(flavour) + flavours.item flavour.to_sym, safe_join([fa_icon('star fw'), t("flavours.#{flavour}.name", default: flavour)]), settings_flavour_path(flavour) end end - n.item :relationships, safe_join([fa_icon('users fw'), t('settings.relationships')]), relationships_url, if: -> { current_user.functional? } + n.item :relationships, safe_join([fa_icon('users fw'), t('settings.relationships')]), relationships_path, if: -> { current_user.functional? } n.item :filters, safe_join([fa_icon('filter fw'), t('filters.index.title')]), filters_path, highlights_on: %r{/filters}, if: -> { current_user.functional? } - n.item :statuses_cleanup, safe_join([fa_icon('history fw'), t('settings.statuses_cleanup')]), statuses_cleanup_url, if: -> { current_user.functional? } + n.item :statuses_cleanup, safe_join([fa_icon('history fw'), t('settings.statuses_cleanup')]), statuses_cleanup_path, if: -> { current_user.functional? } - n.item :security, safe_join([fa_icon('lock fw'), t('settings.account')]), edit_user_registration_url do |s| - s.item :password, safe_join([fa_icon('lock fw'), t('settings.account_settings')]), edit_user_registration_url, highlights_on: %r{/auth/edit|/settings/delete|/settings/migration|/settings/aliases|/settings/login_activities|^/disputes} - s.item :two_factor_authentication, safe_join([fa_icon('mobile fw'), t('settings.two_factor_authentication')]), settings_two_factor_authentication_methods_url, highlights_on: %r{/settings/two_factor_authentication|/settings/otp_authentication|/settings/security_keys} - s.item :authorized_apps, safe_join([fa_icon('list fw'), t('settings.authorized_apps')]), oauth_authorized_applications_url + n.item :security, safe_join([fa_icon('lock fw'), t('settings.account')]), edit_user_registration_path do |s| + s.item :password, safe_join([fa_icon('lock fw'), t('settings.account_settings')]), edit_user_registration_path, highlights_on: %r{/auth/edit|/settings/delete|/settings/migration|/settings/aliases|/settings/login_activities|^/disputes} + s.item :two_factor_authentication, safe_join([fa_icon('mobile fw'), t('settings.two_factor_authentication')]), settings_two_factor_authentication_methods_path, highlights_on: %r{/settings/two_factor_authentication|/settings/otp_authentication|/settings/security_keys} + s.item :authorized_apps, safe_join([fa_icon('list fw'), t('settings.authorized_apps')]), oauth_authorized_applications_path end - n.item :data, safe_join([fa_icon('cloud-download fw'), t('settings.import_and_export')]), settings_export_url do |s| - s.item :import, safe_join([fa_icon('cloud-upload fw'), t('settings.import')]), settings_import_url, if: -> { current_user.functional? } - s.item :export, safe_join([fa_icon('cloud-download fw'), t('settings.export')]), settings_export_url + n.item :data, safe_join([fa_icon('cloud-download fw'), t('settings.import_and_export')]), settings_export_path do |s| + s.item :import, safe_join([fa_icon('cloud-upload fw'), t('settings.import')]), settings_import_path, if: -> { current_user.functional? } + s.item :export, safe_join([fa_icon('cloud-download fw'), t('settings.export')]), settings_export_path end - n.item :invites, safe_join([fa_icon('user-plus fw'), t('invites.title')]), invites_path, if: proc { Setting.min_invite_role == 'user' && current_user.functional? } - n.item :development, safe_join([fa_icon('code fw'), t('settings.development')]), settings_applications_url, if: -> { current_user.functional? } + n.item :invites, safe_join([fa_icon('user-plus fw'), t('invites.title')]), invites_path, if: -> { current_user.can?(:invite_users) && current_user.functional? } + n.item :development, safe_join([fa_icon('code fw'), t('settings.development')]), settings_applications_path, if: -> { current_user.functional? } - n.item :trends, safe_join([fa_icon('fire fw'), t('admin.trends.title')]), admin_trends_tags_path, if: proc { current_user.staff? } do |s| + n.item :trends, safe_join([fa_icon('fire fw'), t('admin.trends.title')]), admin_trends_statuses_path, if: -> { current_user.can?(:manage_taxonomies) } do |s| s.item :statuses, safe_join([fa_icon('comments-o fw'), t('admin.trends.statuses.title')]), admin_trends_statuses_path, highlights_on: %r{/admin/trends/statuses} s.item :tags, safe_join([fa_icon('hashtag fw'), t('admin.trends.tags.title')]), admin_trends_tags_path, highlights_on: %r{/admin/tags|/admin/trends/tags} s.item :links, safe_join([fa_icon('newspaper-o fw'), t('admin.trends.links.title')]), admin_trends_links_path, highlights_on: %r{/admin/trends/links} end - n.item :moderation, safe_join([fa_icon('gavel fw'), t('moderation.title')]), admin_reports_url, if: proc { current_user.staff? } do |s| - s.item :action_logs, safe_join([fa_icon('bars fw'), t('admin.action_logs.title')]), admin_action_logs_url - s.item :reports, safe_join([fa_icon('flag fw'), t('admin.reports.title')]), admin_reports_url, highlights_on: %r{/admin/reports} - s.item :accounts, safe_join([fa_icon('users fw'), t('admin.accounts.title')]), admin_accounts_url(origin: 'local'), highlights_on: %r{/admin/accounts|/admin/pending_accounts|/admin/disputes} - s.item :invites, safe_join([fa_icon('user-plus fw'), t('admin.invites.title')]), admin_invites_path - s.item :follow_recommendations, safe_join([fa_icon('user-plus fw'), t('admin.follow_recommendations.title')]), admin_follow_recommendations_path, highlights_on: %r{/admin/follow_recommendations} - s.item :instances, safe_join([fa_icon('cloud fw'), t('admin.instances.title')]), admin_instances_url(limited: whitelist_mode? ? nil : '1'), highlights_on: %r{/admin/instances|/admin/domain_blocks|/admin/domain_allows}, if: -> { current_user.admin? } - s.item :email_domain_blocks, safe_join([fa_icon('envelope fw'), t('admin.email_domain_blocks.title')]), admin_email_domain_blocks_url, highlights_on: %r{/admin/email_domain_blocks}, if: -> { current_user.admin? } - s.item :ip_blocks, safe_join([fa_icon('ban fw'), t('admin.ip_blocks.title')]), admin_ip_blocks_url, highlights_on: %r{/admin/ip_blocks}, if: -> { current_user.admin? } + n.item :moderation, safe_join([fa_icon('gavel fw'), t('moderation.title')]), nil, if: -> { current_user.can?(:manage_reports, :view_audit_log, :manage_users, :manage_invites, :manage_taxonomies, :manage_federation, :manage_blocks) } do |s| + s.item :reports, safe_join([fa_icon('flag fw'), t('admin.reports.title')]), admin_reports_path, highlights_on: %r{/admin/reports}, if: -> { current_user.can?(:manage_reports) } + s.item :accounts, safe_join([fa_icon('users fw'), t('admin.accounts.title')]), admin_accounts_path(origin: 'local'), highlights_on: %r{/admin/accounts|/admin/pending_accounts|/admin/disputes|/admin/users}, if: -> { current_user.can?(:manage_users) } + s.item :invites, safe_join([fa_icon('user-plus fw'), t('admin.invites.title')]), admin_invites_path, if: -> { current_user.can?(:manage_invites) } + s.item :follow_recommendations, safe_join([fa_icon('user-plus fw'), t('admin.follow_recommendations.title')]), admin_follow_recommendations_path, highlights_on: %r{/admin/follow_recommendations}, if: -> { current_user.can?(:manage_taxonomies) } + s.item :instances, safe_join([fa_icon('cloud fw'), t('admin.instances.title')]), admin_instances_path(limited: whitelist_mode? ? nil : '1'), highlights_on: %r{/admin/instances|/admin/domain_blocks|/admin/domain_allows}, if: -> { current_user.can?(:manage_federation) } + s.item :email_domain_blocks, safe_join([fa_icon('envelope fw'), t('admin.email_domain_blocks.title')]), admin_email_domain_blocks_path, highlights_on: %r{/admin/email_domain_blocks}, if: -> { current_user.can?(:manage_blocks) } + s.item :ip_blocks, safe_join([fa_icon('ban fw'), t('admin.ip_blocks.title')]), admin_ip_blocks_path, highlights_on: %r{/admin/ip_blocks}, if: -> { current_user.can?(:manage_blocks) } + s.item :action_logs, safe_join([fa_icon('bars fw'), t('admin.action_logs.title')]), admin_action_logs_path, if: -> { current_user.can?(:view_audit_log) } end - n.item :admin, safe_join([fa_icon('cogs fw'), t('admin.title')]), admin_dashboard_url, if: proc { current_user.staff? } do |s| - s.item :dashboard, safe_join([fa_icon('tachometer fw'), t('admin.dashboard.title')]), admin_dashboard_url - s.item :settings, safe_join([fa_icon('cogs fw'), t('admin.settings.title')]), edit_admin_settings_url, if: -> { current_user.admin? }, highlights_on: %r{/admin/settings} - s.item :rules, safe_join([fa_icon('gavel fw'), t('admin.rules.title')]), admin_rules_path, highlights_on: %r{/admin/rules} - s.item :announcements, safe_join([fa_icon('bullhorn fw'), t('admin.announcements.title')]), admin_announcements_path, highlights_on: %r{/admin/announcements} - s.item :custom_emojis, safe_join([fa_icon('smile-o fw'), t('admin.custom_emojis.title')]), admin_custom_emojis_url, highlights_on: %r{/admin/custom_emojis} - s.item :webhooks, safe_join([fa_icon('inbox fw'), t('admin.webhooks.title')]), admin_webhooks_path, highlights_on: %r{/admin/webhooks} - s.item :relays, safe_join([fa_icon('exchange fw'), t('admin.relays.title')]), admin_relays_url, if: -> { current_user.admin? && !whitelist_mode? }, highlights_on: %r{/admin/relays} - s.item :sidekiq, safe_join([fa_icon('diamond fw'), 'Sidekiq']), sidekiq_url, link_html: { target: 'sidekiq' }, if: -> { current_user.admin? } - s.item :pghero, safe_join([fa_icon('database fw'), 'PgHero']), pghero_url, link_html: { target: 'pghero' }, if: -> { current_user.admin? } + n.item :admin, safe_join([fa_icon('cogs fw'), t('admin.title')]), nil, if: -> { current_user.can?(:view_dashboard, :manage_settings, :manage_rules, :manage_announcements, :manage_custom_emojis, :manage_webhooks, :manage_federation) } do |s| + s.item :dashboard, safe_join([fa_icon('tachometer fw'), t('admin.dashboard.title')]), admin_dashboard_path, if: -> { current_user.can?(:view_dashboard) } + s.item :settings, safe_join([fa_icon('cogs fw'), t('admin.settings.title')]), edit_admin_settings_path, if: -> { current_user.can?(:manage_settings) }, highlights_on: %r{/admin/settings} + s.item :rules, safe_join([fa_icon('gavel fw'), t('admin.rules.title')]), admin_rules_path, highlights_on: %r{/admin/rules}, if: -> { current_user.can?(:manage_rules) } + s.item :roles, safe_join([fa_icon('vcard fw'), t('admin.roles.title')]), admin_roles_path, highlights_on: %r{/admin/roles}, if: -> { current_user.can?(:manage_roles) } + s.item :announcements, safe_join([fa_icon('bullhorn fw'), t('admin.announcements.title')]), admin_announcements_path, highlights_on: %r{/admin/announcements}, if: -> { current_user.can?(:manage_announcements) } + s.item :custom_emojis, safe_join([fa_icon('smile-o fw'), t('admin.custom_emojis.title')]), admin_custom_emojis_path, highlights_on: %r{/admin/custom_emojis}, if: -> { current_user.can?(:manage_custom_emojis) } + s.item :webhooks, safe_join([fa_icon('inbox fw'), t('admin.webhooks.title')]), admin_webhooks_path, highlights_on: %r{/admin/webhooks}, if: -> { current_user.can?(:manage_webhooks) } + s.item :relays, safe_join([fa_icon('exchange fw'), t('admin.relays.title')]), admin_relays_path, highlights_on: %r{/admin/relays}, if: -> { !whitelist_mode? && current_user.can?(:manage_federation) } end - n.item :logout, safe_join([fa_icon('sign-out fw'), t('auth.logout')]), destroy_user_session_url, link_html: { 'data-method' => 'delete' } + n.item :sidekiq, safe_join([fa_icon('diamond fw'), 'Sidekiq']), sidekiq_path, link_html: { target: 'sidekiq' }, if: -> { current_user.can?(:view_devops) } + n.item :pghero, safe_join([fa_icon('database fw'), 'PgHero']), pghero_path, link_html: { target: 'pghero' }, if: -> { current_user.can?(:view_devops) } + n.item :logout, safe_join([fa_icon('sign-out fw'), t('auth.logout')]), destroy_user_session_path, link_html: { 'data-method' => 'delete' } end end diff --git a/config/roles.yml b/config/roles.yml new file mode 100644 index 000000000..f443250d1 --- /dev/null +++ b/config/roles.yml @@ -0,0 +1,35 @@ +moderator: + name: Moderator + position: 10 + permissions: + - view_dashboard + - view_audit_log + - manage_users + - manage_reports + - manage_taxonomies +admin: + name: Admin + position: 100 + permissions: + - view_dashboard + - view_audit_log + - manage_users + - manage_user_access + - delete_user_data + - manage_reports + - manage_taxonomies + - manage_federation + - manage_settings + - manage_blocks + - manage_appeals + - manage_rules + - manage_invites + - manage_announcements + - manage_custom_emojis + - manage_webhooks + - manage_roles +owner: + name: Owner + position: 1000 + permissions: + - administrator diff --git a/config/routes.rb b/config/routes.rb index d778997c1..1132cc7e7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,7 +10,7 @@ Rails.application.routes.draw do get 'health', to: 'health#show' - authenticate :user, lambda { |u| u.admin? } do + authenticate :user, lambda { |u| u.role&.can?(:view_devops) } do mount Sidekiq::Web, at: 'sidekiq', as: :sidekiq mount PgHero::Engine, at: 'pghero', as: :pghero end @@ -316,17 +316,11 @@ Rails.application.routes.draw do post :resend end end - - resource :role, only: [] do - member do - post :promote - post :demote - end - end end resources :users, only: [] do - resource :two_factor_authentication, only: [:destroy] + resource :two_factor_authentication, only: [:destroy], controller: 'users/two_factor_authentications' + resource :role, only: [:show, :update], controller: 'users/roles' end resources :custom_emojis, only: [:index, :new, :create] do @@ -341,6 +335,7 @@ Rails.application.routes.draw do end end + resources :roles, except: [:show] resources :account_moderation_notes, only: [:create, :destroy] resource :follow_recommendations, only: [:show, :update] resources :tags, only: [:show, :update] |