<commit_before>class AdminController < ActionController::Base
    layout "base"
    #before_action :authenticate_user!, :authorize_user
    include EmailHelper
    
    def authorize_user
        if not User.find(current_user.id).admin
            redirect_to "/dashboard"
        end
    end
    
    def user_params
      params.require(:user).permit(:email, :password, :password_confirmation, :name, :title, :committee, :board_role, :current_company,
        :current_position, :about_me, :why_join, :interests_skills, :internal, :external, :executive, :admin, expertise_ids:[])
    end

    def calendar_params
        params.require(:calendar).permit(:html)
    end
    
    def announcement_params
        params.require(:announcement).permit(:title, :content)
    end
    
    def index
        @users = User.all
        @announcement_list = Announcement.where(committee_type: "dashboard").order(created_at: :DESC)
        if !current_user.admin
            flash[:message] = "Access not granted. Please sign in again."
            redirect_to("/users/sign_in")
        end
    end
    
    def edit_user
        authenticate_user!
        authorize_user
        @user = User.find params[:id]
    end
    
    def update_user<commit_msg>fixed main announcement not appearing on admin page<commit_after>class AdminController < ActionController::Base
    layout "base"
    #before_action :authenticate_user!, :authorize_user
    include EmailHelper
    
    def authorize_user
        if not User.find(current_user.id).admin
            redirect_to "/dashboard"
        end
    end
    
    def user_params
      params.require(:user).permit(:email, :password, :password_confirmation, :name, :title, :committee, :board_role, :current_company,
        :current_position, :about_me, :why_join, :interests_skills, :internal, :external, :executive, :admin, expertise_ids:[])
    end

    def calendar_params
        params.require(:calendar).permit(:html)
    end
    
    def announcement_params
        params.require(:announcement).permit(:title, :content)
    end
    
    def index
        @users = User.all
        @announcement_list = Announcement.where(committee_type: "").order(created_at: :DESC)
        if !current_user.admin
            flash[:message] = "Access not granted. Please sign in again."
            redirect_to("/users/sign_in")
        end
    end
    
    def edit_user
        authenticate_user!
        authorize_user
        @user = User.find params[:id]
    end
    
    def update_user
{'fraction_non_alphanumeric': 0.09535160905840286, 'fraction_numerical': 0.0, 'mean_word_length': 2.713864306784661, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '346893', 'n_tokens_mistral': 739, 'n_tokens_neox': 727, 'n_words': 164}