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

Unhide financial acls, disable if not required. #29360

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Feb 10, 2024

We should also

  • stop enabling on install - probably first! I can't recall where we do that...
    @colemanw I started thinking about how we would do this -

Note my other PRs working this out of core are #28967 & #28960 -

Overview

Unhide financial acls, disable if not required.

Before

financialacls extension installed on all sites, disabled if setting not set, hidden

After

unhidden, no setting, uninstalled on sites that do not have the setting set

Technical Details

I think the main way in which core calls the extension currently is where you see isACLFinancialTypeStatus() - my most recent effort to address that is in #28967 & I guess we can't remove the setting as long as tose calls exist - hence this is still WIP - we could check if the extension is enabled - fugly but...

image

Comments

If this feature were to be built now the entire thing would be outside core, community supported, using hooks & I think that is ideally where it will end up. However, it was implemented a long time ago when there was less hook support

Copy link

civibot bot commented Feb 10, 2024

🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷

Introduction for new contributors...
  • If this is your first PR, an admin will greenlight automated testing with the command ok to test or add to whitelist.
  • A series of tests will automatically run. You can see the results at the bottom of this page (if there are any problems, it will include a link to see what went wrong).
  • A demo site will be built where anyone can try out a version of CiviCRM that includes your changes.
  • If this process needs to be repeated, an admin will issue the command test this please to rerun tests and build a new demo site.
  • Before this PR can be merged, it needs to be reviewed. Please keep in mind that reviewers are volunteers, and their response time can vary from a few hours to a few weeks depending on their availability and their knowledge of this particular part of CiviCRM.
  • A great way to speed up this process is to "trade reviews" with someone - find an open PR that you feel able to review, and leave a comment like "I'm reviewing this now, could you please review mine?" (include a link to yours). You don't have to wait for a response to get started (and you don't have to stop at one!) the more you review, the faster this process goes for everyone 😄
  • To ensure that you are credited properly in the final release notes, please add yourself to contributor-key.yml
  • For more information about contributing, see CONTRIBUTING.md.
Quick links for reviewers...

➡️ Online demo of this PR 🔗

@civibot civibot bot added the master label Feb 10, 2024
@eileenmcnaughton eileenmcnaughton changed the title [wip] Unhide financial acls, disable if not required. Unhide financial acls, disable if not required. Feb 23, 2024
@eileenmcnaughton eileenmcnaughton force-pushed the fin_expose branch 2 times, most recently from 2ccddf1 to 4b5563d Compare March 7, 2024 01:22
@eileenmcnaughton
Copy link
Contributor Author

@colemanw this is passing now!

if (!$setting) {
return TRUE;
}
$setting = unserialize($setting);
if ($setting) {
Copy link
Member

Choose a reason for hiding this comment

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

@eileenmcnaughton I'm confused about what this code is doing. Why the unserialize()? The setting appears to be a boolean, not serialized:

Civi::settings()->set('acl_financial_type', TRUE);

Copy link
Member

Choose a reason for hiding this comment

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

Oh, ok I guess you have to unserialize because you're pulling it directly from the database?
But now I'm still confused because the logic appears to be backward. You are uninstalling the extension if the setting is TRUE? Shouldn't it be the other way 'round?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@colemanw yep.... it should be...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@colemanw above is fixed

@seamuslee001
Copy link
Contributor

note just flagging at the moment if a user wants to disable civi_contribute extension / Contribute Component the financialacls block it

@eileenmcnaughton
Copy link
Contributor Author

@seamuslee001 yeah - that is what this is supposed to help with - ie disable it for most users. There is another PR open to further move the logic over but struggling to get engagement on that one #28967 - possibly 'cheap & cheerful acls' should be in the core extension & only the JMA extension would have 'thorough but performance-harsh' acls but at the moment we have a bit of both in core

$financialAclExtension = civicrm_api3('extension', 'get', ['key' => 'biz.jmaconsulting.financialaclreport', 'sequential' => 1]);
if ($ftAclSetting && (($financialAclExtension['count'] == 1 && $financialAclExtension['values'][0]['status'] != 'installed') || $financialAclExtension['count'] !== 1)) {
if (($financialAclExtension['count'] == 1 && $financialAclExtension['values'][0]['status'] !== 'installed') || $financialAclExtension['count'] !== 1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so I had doubts about how valid this is now - it does depend on where we land with #28967 - ie do we

a) do expensive, super thorough thing in in core & make the extension obsolete or
b) do the thing that performs well & is probably enough for most cases in core & recommend people use the extension for the expensive thing - I haven't had any engagement from @JoeMurray or @seamuslee001 on that but I think the value of the check is grey enough that removing for now seems OK

Copy link
Contributor Author

Choose a reason for hiding this comment

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

now that @seamuslee001 has merged #28967 this check can go

@eileenmcnaughton eileenmcnaughton force-pushed the fin_expose branch 3 times, most recently from 2e3f812 to 01e6b7d Compare May 24, 2024 00:48
@eileenmcnaughton
Copy link
Contributor Author

This was held up because of lack of clarity around the check - but the merging of #28967 means the check / extension is no longer relevant so I have removed it. The previous review otherwise tested this so I think it should be mergeable too @seamuslee001 - I updated the upgrader version

@@ -396,10 +396,23 @@ public static function checkPermissionToEditFinancialType($financialTypeID) {
*
* @todo rename this function e.g isFinancialTypeACLsEnabled.
*
* @deprecated since 5.75 will be removed around 5.90
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this have a deprecatedWarning call as well?

Copy link
Contributor Author

@eileenmcnaughton eileenmcnaughton May 24, 2024

Choose a reason for hiding this comment

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

We actually have core calls to it still - so the removal date is probably optimistic but we can always push it back - but I want people to still see it in their IDE

@eileenmcnaughton eileenmcnaughton force-pushed the fin_expose branch 3 times, most recently from c3b788f to e4dd6b3 Compare May 24, 2024 11:14
@eileenmcnaughton
Copy link
Contributor Author

Just rebased this but it was passing - should be good to merge now I think

@eileenmcnaughton
Copy link
Contributor Author

@colemanw can you give this MOP since all the issues are resolved now

@eileenmcnaughton eileenmcnaughton merged commit b3824b7 into civicrm:master Jun 6, 2024
1 check passed
@eileenmcnaughton eileenmcnaughton deleted the fin_expose branch June 6, 2024 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants