How can I make an access control, visually, in ruby on Rails?

Asked

Viewed 171 times

0

I’ve already done the part gráfica(FRONT), however I am having problems in the part of the code.

The access control works as follows: if the new group (or profile) is created, I can decide what permissions it will have within the system, that is, whether you can read, edit, create or delete CRUDS.

Problem: I don’t know how to call these methods from a simple checkbox.

A PARTE GRÁFICA :

OBS: I AM USING THE ADMINISTRATION MANAGER ACTIVE_ADMIN

Here is the controller of active_admin that takes care of this part of access control:

ActiveAdmin.register ControleAcesso do
  permit_params [:grupo, :Noticium]

  controller do
    def i
      @noticia = Noticium.all
      @mural_atividades = MuralAtividade.all
      @minhas_atividades = MinhasAtividade.all
    end
  end

    index do
    column :grupo
    actions
  end
  
   form do |f|
    f.inputs "Controle de Acesso" do
           f.input :grupo, :label => 'Nome do Grupo'
        end

     tabs do 
      tab "Minhas Atividades" do
          f.inputs "Minhas Atividades" do
           f.input :Minhas_Atividades, as: :check_boxes, :collection => ['Criar', 'Visualizar', 'Editar', 'Deletar'], :label => 'Atividades'
         end 
       end

       tab "Mural de Atividades" do
         f.inputs "Mural de Atividades" do
           f.input :Mural_Atividades, as: :check_boxes, :collection => ['Criar', 'Visualizar', 'Editar', 'Deletar'], :label => 'Atividades'
          end
        end

        tab "Meu Perfil" do
          f.inputs "Meu Perfil" do
          f.input :Meu_Perfil, as: :check_boxes, :collection => ['Criar', 'Visualizar', 'Editar', 'Deletar'], :label => 'Perfil'
          end
        end

        tab "Notícias" do
          f.inputs "Noticias" do
          f.input :Noticium, as: :check_boxes, :collection => ['Criar', 'Visualizar', 'Editar', 'Deletar'], :label => 'Notícias'
          end
        end
      end
        f.actions
      end
end

  • Failed to describe in question what are the problems you are encountering.

  • yeah, could be kkk, I have to clarify more my problems...

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.