-
Notifications
You must be signed in to change notification settings - Fork 175
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
Add project to PSCID generation #5285
Add project to PSCID generation #5285
Conversation
php/libraries/Candidate.class.inc
Outdated
@@ -191,7 +191,7 @@ class Candidate | |||
* configured to be true. | |||
* @param string $sex sex, either 'Male' or 'Female' | |||
* @param string|null $PSCID PSCID specified by the user, if available | |||
* @param int|null $projectID The project ID, if available | |||
* @param int $projectID The project ID, if available |
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.
It might be nice to change this signature to actually pass a Project object instead of an ID here, if possible. We'd benefit from built-in validation this way.
Up to you though - I'm not sure how complicated this would be.
@@ -306,7 +307,8 @@ class Utility | |||
*/ | |||
static function structureToPCRE( | |||
array $structure, | |||
?string $siteAbbrev = null | |||
?string $siteAbbrev = null, |
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.
Consider changing this to $prefix
and only using one variable since the validation for $projAbbrev
and $siteAbbrev
do the same thing anyway.
This also allows calling code for project abbreviations to be Utility::structureToPCRE(array, ?string)
instead of Utility::structureToPCRE(array, ?string, ?string)
meaning that it doesn't need to always use null
for the second argument.
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.
@johnsaigle I'd like to keep both finally. I would like to be able to one day generate Ids with more than one prefix.
I know it's not the case right now but I think users should be able to generate PROJ-SITE-0000 IDs and that would not be possible with passing around a single prefix
value.
cf5938c
to
68c34be
Compare
Documentation will be done in a different PR to avoid another rebase |
a60437a
to
23976aa
Compare
Brief summary of changes
Added option to generate PSCIDs using the project alias instead of the site alias. this is needed by several projects where permissions will be more project oriented then site.
to test:
static
,siteAbbrev
andprojectAbbrev
make sure the correct PSCID gets generated