Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Active Admin - Pundit #378

Merged
merged 1 commit into from
Sep 27, 2021
Merged

Active Admin - Pundit #378

merged 1 commit into from
Sep 27, 2021

Conversation

ldlsegovia
Copy link
Collaborator

@ldlsegovia ldlsegovia commented Jul 13, 2021

Different pundit settings for app and Active Admin.
Active admin policies now go inside the BackOffice namespace.
Active admin policies now inherit from BackOffice::DefaultPolicy.

@ldlsegovia ldlsegovia force-pushed the pundit-admin branch 2 times, most recently from 9c7ceeb to 3a7a0dc Compare September 20, 2021 15:13
@ldlsegovia ldlsegovia changed the title WIP: Active Admin - Pundit Active Admin - Pundit Sep 20, 2021
Copy link
Member

@rjherrera rjherrera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

se ve bacán! te dejé una duda pa confirmar, pero fuera de eso, no sé si valdrá la pena hacer un comentario en el readme (de potassium o del proyecto) dado que esto no es tan común o no?

@@ -0,0 +1,2 @@
class BackOffice::AdminUserPolicy < BackOffice::DefaultPolicy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no sé si tiene sentido, pero deberíamos poner estas policies en una carpeta back_office?

destination_path = [model_namespace, policy_name].compact.join("/")
template(
"../assets/active_admin/policies/#{policy_name}.rb",
"app/policies/back_office/#{destination_path}.rb"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah en el proyecto quedan ahí 👌🏻 , retiro lo dicho jaja

copy_policy("default_policy")
copy_policy("admin_user_policy")
copy_policy("page_policy", "active_admin")
copy_policy("comment_policy", "active_admin")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

la estructura entonces quedaría por ejemplo:

  • app/policies/back_office/default_policy.rb
  • app/policies/back_office/admin_user_policy.rb
  • app/policies/back_office/active_admin/page_policy.rb
  • app/policies/back_office/active_admin/comment_policy.rb
    y eventualmente:
  • app/policies/back_office/my_cool_model_policy.rb

eso o no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

se ve bacán! te dejé una duda pa confirmar, pero fuera de eso, no sé si valdrá la pena hacer un comentario en el readme (de potassium o del proyecto) dado que esto no es tan común o no?

Pensé que la estructura lo hacía más obvio pero quizás no. Voy a agregarle info al README 👍🏻

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

las debajo de active_admin como que me costaba procesarlas

@ldlsegovia ldlsegovia force-pushed the pundit-admin branch 2 times, most recently from 77d22f0 to 76b1a2c Compare September 27, 2021 20:05
@@ -153,6 +153,26 @@ readme:
```
- You can also use **any** vue bindings such as `v-for` , `:key` etc.
<% end %>
<% if get(:authorization) %>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rjherrera le agregué el README

`app/policies/back_office/client_policy.rb`:

```ruby
class BackOffice::CLientPolicy < BackOffice::DefaultPolicy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mini typo CLient

@ldlsegovia ldlsegovia merged commit 4e8d366 into master Sep 27, 2021
@ldlsegovia ldlsegovia deleted the pundit-admin branch September 27, 2021 20:39
ldlsegovia added a commit that referenced this pull request Sep 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants