Skip to content
This repository was archived by the owner on Jan 25, 2021. It is now read-only.

Conversation

@tramuntanal
Copy link
Contributor

No description provided.

@tramuntanal
Copy link
Contributor Author

Hi @xredo ,
Are you going to keep the maintenance of the module? 🤔
Should be consider it unmantained and stop PRing to it ❓

Thanks! 😄

@artero
Copy link
Member

artero commented Nov 26, 2018

HI @tramuntanal, I'm Juan from MarsBased. I'm doing this PR review but I have problems testing this branch.

After run:

bin/rails decidim:generate_external_test_app
rspec

I have these errors:

 12) Decidim::FileAuthorizationHandler::Admin::CensusesController POST #delete_all clear all census data
      Failure/Error: 5.times { FactoryBot.create :census_datum, organization: organization }

      ActiveRecord::StatementInvalid:
        PG::UndefinedTable: ERROR:  relation "decidim_file_authorization_handler_census_data" does not exist
        LINE 8:                WHERE a.attrelid = '"decidim_file_authorizati...

This doesn't happen in the master branch.

Looks like as in that Decidim version the gem's migrations don't charge in the dummy app

Do you have the same problem?

@tramuntanal
Copy link
Contributor Author

Yes, its seems that the migration is not automatically copied into the dummy app. We had to manually copy the file:

cp db/migrate/20171110120821_create_decidim_file_authorization_handler_census_datum.rb spec/decidim_dummy_app/db/migrate/

I'll bring this issue to Decidim's main project

@artero
Copy link
Member

artero commented Nov 26, 2018

Ok, thank you very much!

Copy link
Member

@artero artero left a comment

Choose a reason for hiding this comment

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

Hi @tramuntanal

We have reviewed the code and most of the changes are great. It's nice to have the plugin more configurable and some bugs solved (apart from the upgrade). I would like to apology again in the name of MarsBased for not having performed the reviews before.

We have noticed what it seems to be a bug in the code and we have some doubts that we would like to solve with you before accepting the Pull Request.

Could you please take a look at the comments? Thank you!

return permission_action if permission_action.scope != :admin
return Decidim::Proposals::Admin::Permissions.new(user, permission_action, context).permissions if permission_action.scope == :admin
if user.organization.available_authorizations.include?("file_authorization_handler")
if permission_action_in(:manage, :read)
Copy link
Member

Choose a reason for hiding this comment

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

Should not this be permission_action_in??

module FileAuthorizationHandler
class AdminEngine < ::Rails::Engine
isolate_namespace Decidim::FileAuthorizationHandler::Admin
paths["db/migrate"] = nil
Copy link
Member

Choose a reason for hiding this comment

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

Why is it required to remove the migrate path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was causing apps to crash, I don't remember the exact situation. By the way, what does it mean to set paths["db/migrate"]= nil to not load migrations at runtime?

class Permissions < Decidim::DefaultPermissions
def permissions
return permission_action if permission_action.scope != :admin
return Decidim::Proposals::Admin::Permissions.new(user, permission_action, context).permissions if permission_action.scope == :admin
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need the Proposal permissions here?

Copy link
Member

Choose a reason for hiding this comment

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

I think the lines 12 to 16 never run, because if permission_action.scope != :admin returns line 10 and if not returns line 11.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I rebuilt it.

module FileAuthorizationHandler
module Admin
# Defines the abilities related to surveys for a logged in admin user.
# Intended to be used with `cancancan`.
Copy link
Member

Choose a reason for hiding this comment

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

We to remove this comment

class Permissions < Decidim::DefaultPermissions
def permissions
return permission_action unless user
return Decidim::FileAuthorizationHandler::Admin::Permissions.new(user, permission_action, context).permissions if permission_action.scope == :admin
Copy link
Member

Choose a reason for hiding this comment

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

Maybe I am missing something, but I don't see why we need to check for the Admin permissions in here. Could you explain the use case? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've removed this file as there is no one is using it.

@tramuntanal
Copy link
Contributor Author

Hi @artero sorry I lost notifications and didn't know you made the review.
I'll give you feedback in a week or two.

@tramuntanal
Copy link
Contributor Author

Hi @artero the PR has been updated as requested.

Copy link
Member

@artero artero left a comment

Choose a reason for hiding this comment

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

We can merge, Thankyou very much!

@artero artero merged commit f01aaa7 into MarsBased:master Jan 14, 2019
@tramuntanal tramuntanal deleted the upgrade/decidim-0.15 branch January 14, 2019 12:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants