Skip to content

Conversation

@mtompset
Copy link
Contributor

Add

  • Specific exceptions for group existing, not existing, or group settings not existing

Fix

  • Run Dockerfile as nonroot when needed
  • Improve code by using specific exceptions rather than a generic one
  • Correct aliases on User records to match the UserAlias record
  • Lookup of users by alias, not just email address
  • Use constants for repeated error messages
  • Use variable instead of hardcoded Staff ID value in tests
  • Changed from SHA-1 to SHA-512 like MailAdmin does now
  • Remove unnecessary brackets on return values

mtompset added 17 commits March 12, 2025 17:37
The composer.json version must match the release version
in order for packagist to pick it up.
if (condition) { return true; } else { return false; }
can be reduced to:
return condition;

Less return statements is easier to debug, and makes Sonar
Qube happy.
Corrected 3 return statements which were of the form
return (condition);
There is no need for the ()'s.
Created a constant for when group insert fails.
It is a template, so it can be used in an sprintf().
assertEquals(a,b,msg) is better code than
assertTrue(a === b, msg).
assertSame supposedly does type checking too.
When the group does or does not exist, that may cause an
exception.
PHP files generally should end on a new line.
It doesn't make sense to try to update Group Settings
when there aren't Group Settings to update.
By setting the permissions of the copied files and
ending with USER 1000, a non-privileged user should be used
Sure I have to change, but I end with non-root too!
This should be safer.
This will avoid accidentally copying git development things,
jetbrain IDE things, etcetera into the docker container.
Merging RUN commands where possible, and use WORKDIR instead of "cd"
@mtompset mtompset requested review from a team, briskt, ethancanne, forevermatt and jason-jackson and removed request for a team March 25, 2025 14:48
@mtompset mtompset self-assigned this Mar 25, 2025
@sonarqubecloud
Copy link

@mtompset mtompset merged commit 6486b54 into main Mar 25, 2025
2 checks passed
chmod 664 /data/SilMock/tests/.phpunit.result.cache

WORKDIR /data
RUN ./composer-install.sh && mv /data/composer.phar /usr/bin/composer
Copy link
Contributor

Choose a reason for hiding this comment

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

If at some point you want to simplify this (to possibly get rid of the need for a composer-install.sh script), you can also just copy the composer binary from their Docker image, like so:

COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer

You can use whatever version tag you want to, after the colon in that --from parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants