Skip to content

Comments

pkp/pkp-lib/#10571 email access restrictions#11090

Merged
taslangraham merged 23 commits intopkp:mainfrom
taslangraham:feature-i10403-email-access-restrictions
Apr 9, 2025
Merged

pkp/pkp-lib/#10571 email access restrictions#11090
taslangraham merged 23 commits intopkp:mainfrom
taslangraham:feature-i10403-email-access-restrictions

Conversation

@taslangraham
Copy link
Contributor

For #10571

@taslangraham taslangraham marked this pull request as ready for review March 14, 2025 02:20
@taslangraham taslangraham force-pushed the feature-i10403-email-access-restrictions branch 3 times, most recently from d4b1aa5 to e52d322 Compare March 20, 2025 22:47
@ewhanson ewhanson self-requested a review March 31, 2025 19:01
throw new Exception('Invalid value given for the `isUnrestricted` attribute on the ' . $attrs['key'] . ' template.');
}

$contextIds = app()->get('context')->getIds();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason to use the app() helper instead of one of the built in PKP methods to get all context IDs? Would a method from Application::get()->getContextDao() work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The closest thing to getIds that is available via Application::get()->getContextDao() is a getAll method, but that returns a DAOResultFactory with objects for all context which you'd then have to process to get all IDs. However, going through the code, I saw that app()->get('context')->getIds() was routinely used to get all IDs so I went with that appraoch.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, that makes sense. And I don't recall the context now, but I remember loading the entirety of all contexts at once had performance implications on larger installs, so this all sounds good.

->whereNot('user_group_id', null)
->get()
->pluck('userGroupId')
->all();
Copy link
Contributor

Choose a reason for hiding this comment

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

Also wondering about the difference between using toArray() vs. all() here and the use of pluck above.

Copy link
Contributor Author

@taslangraham taslangraham Apr 9, 2025

Choose a reason for hiding this comment

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

Given that we operating on a simple result from usage of pluck, I don't think there's any real difference. For consistency I've updated both places to use the all

Copy link
Contributor

Choose a reason for hiding this comment

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

Perfect. Didn't imagine there was a huge difference, but good to settle on a consistent way of doing it.

@taslangraham taslangraham force-pushed the feature-i10403-email-access-restrictions branch from e52d322 to 7e33786 Compare April 9, 2025 14:01
@taslangraham taslangraham merged commit 16c3285 into pkp:main Apr 9, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants