-
Notifications
You must be signed in to change notification settings - Fork 69
Delete a organization + organization policy #368
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1be5c19
- add some missing "dependent: :destroy" in Organization model: fixes…
markets 6c89900
gems: update Pundit to latest release (1.1.0)
markets d34e083
add more OrganizationsController specs
markets 26d77a4
UserPolicy minor DRY refactor:
markets 035117b
add some organizations#show view specs
markets 4bfc636
OrganizatioPolicy: make show action a public page
markets 9418484
delete events when deleting target object
markets 7f6a087
- let's remove PushNotification when we delete an Event
markets 0c6c1e7
Merge branch 'develop' into delete_org and fix conflicts
markets 2231b63
gems: Pundit 2
markets 43b3738
policies: :scissors: Scopes as we are not really using it (policy_sco…
markets 7cc1d11
Merge branch 'develop' into delete_org
markets 14fe6bc
Admin section: Logout user if deleted organization is current_organiz…
markets File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
- add some missing "dependent: :destroy" in Organization model: fixes #…
…359, removes all organization memberships and activity when destroying an org instance - introduce OrganizationPolicy to properly define an access control strategy for Organizations
- Loading branch information
commit 1be5c192977fb0e90ce19f239d1710e4d76bdbdd
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class OrganizationPolicy < ApplicationPolicy | ||
alias_method :organization, :record | ||
|
||
def index? | ||
true | ||
end | ||
|
||
def show? | ||
user&.active?(organization) | ||
end | ||
|
||
def create? | ||
user&.superadmin? | ||
end | ||
|
||
def update? | ||
user&.admins?(organization) | ||
end | ||
end |
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,20 +27,16 @@ | |
<td><%= link_to org.name, org %></td> | ||
<td><%= org.users.count %></td> | ||
<td class="hover-actions"> | ||
<% if current_user.admins?(org) %> | ||
<% if current_user&.admins?(org) %> | ||
<%= link_to edit_organization_path(org), class: 'action' do %> | ||
<%= glyph :pencil %> | ||
<%= t 'global.edit' %> | ||
<% end %> | ||
<%= link_to organization_path(org), | ||
data: { method: :delete }, | ||
class: 'action' do %> | ||
<%= glyph :trash %> | ||
<%= t 'global.borrar' %> | ||
<% end %> | ||
<% end %> | ||
</td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
|
||
<%= paginate @organizations %> | ||
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. are we showing all organizations now?? 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. unfortunately yes, without pagination 🙊 |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I have the same question here
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.
Similar to previous comment, this controller doesn't require authentication at this point, so now you can visit the
/organizations
page without a crash.