-
-
Save Frank004/35f7c98477f71c8d4f73107c58052a21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user.role.permits.each do |k,v| | |
controller_name = v[:controller].include?(":") ? (eval(v[:controller])) : (v[:controller].constantize) | |
can v[:can].map(&:to_sym), controller_name # esto crea dinamicamente los permisos que necesito | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
permits=>{ | |
"inspection_permit"=> { | |
"controller" => "Inspection", | |
"inspection_index" => "Yes", | |
"inspection_show" => "Yes", | |
"inspection_edit" => "No", | |
"inspection_destroy" => "No", | |
"inspection_create" => "Yes", | |
"inspection_report" => "No", | |
"inspection_components" => "No" | |
}, | |
"employee_permit" =>{ | |
"controller" => "Employee", | |
"settings"=> { | |
"employee_index" => "Yes", | |
"employee_show" => "Yes", | |
"employee_edit" => "Yes", | |
"employee_destroy" => "Yes", | |
"employee_create" => "Yes" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment