Sha256: d8d66332d27418f9badd3068019757e8e13845405c3d5413393be02ad331492e
Contents?: true
Size: 1.09 KB
Versions: 3
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true module Decidim # The controller to manage user groups admins class GroupAdminsController < Decidim::ApplicationController include FormFactory helper_method :user_group def index enforce_permission_to :manage, :user_group, user_group: user_group end def demote enforce_permission_to :manage, :user_group, user_group: user_group DemoteMembership.call(membership, user_group) do on(:ok) do flash[:notice] = t("group_admins.demote.success", scope: "decidim") redirect_back fallback_location: group_manage_users_path(user_group.nickname) end on(:invalid) do flash[:alert] = t("group_admins.demote.error", scope: "decidim") redirect_back fallback_location: group_manage_users_path(user_group.nickname) end end end private def user_group @user_group ||= Decidim::UserGroups::ManageableUserGroups.for(current_user).find_by(nickname: params[:group_id]) end def membership user_group.memberships.find(params[:id]) end end end
Version data entries
3 entries across 3 versions & 1 rubygems