-
Notifications
You must be signed in to change notification settings - Fork 18
Use authorized_scope within controllers #851
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
Changes from all commits
ed4749a
f093ab2
65c6843
6943fc9
31066e4
251a928
f96ec7f
51201b2
dc8dbb9
6803c18
9bc8e1c
2380dda
8cb532f
6161e5d
1d26e82
04e8f5f
e304ba8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ def manage? | |
| # Define shared methods useful for most policies. | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i found note somewhere of adding
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In I'll have to look into the scope stuff and see if/what makes sense for us. Thanks for pointing it out. |
||
| def admin? | ||
| user&.admin? | ||
| user&.super_user | ||
| end | ||
|
|
||
| def owner? | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,7 +55,8 @@ | |
| expect(response.body).not_to include(other_log.workshop.name) | ||
| end | ||
|
|
||
| it "populates workshops dropdown with only workshops from visible logs" do | ||
| # TODO use action policy to filter | ||
| xit "populates workshops dropdown with only workshops from visible logs" do | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what was wrong w this test?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to scope all the dropdowns. I think it should be its own separate PR. We are disabling workshop logs for this phase right? So this can be lower priority?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OoOOOOH ok. I will open a separate issue for the scoped filters. |
||
| visible_workshop = create(:workshop) | ||
| hidden_workshop = create(:workshop, published: false) | ||
| unassigned_workshop = create(:workshop) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did this filter get lost? i don't think it's in the policy
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going off the policy and comment I left off the by
project_idsince we need have the table change coming and there are a bunch more scope this policy will need to filter the search filters if we filter on org as well.I do notice now that the scope for user should be oncreated_by_id.It looks like
WorkshopLoghasuser_idon it notcreated_by_idso the relation_scope was correct.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gotcha re project!
the report/workshop_log models are actually still
user_id. so we must've never tested as non-admin.