Skip to content

Commit

Permalink
Merge pull request #228 from silinternational/develop
Browse files Browse the repository at this point in the history
Release 5.5.1
  • Loading branch information
briskt authored Jun 1, 2021
2 parents f0a5f69 + fee66af commit 9529fb5
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 65 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [5.5.1]
### Changed
- Reverse the order of searching for a Google user, now use ID first
- Downgraded PHP back to 7.2

## [5.5.0]
### Added
- In Google adapter, search by email as well as by external ID
### Changed
- Upgraded PHP to 7.4

## [5.4.0]
### Added
Expand Down Expand Up @@ -146,7 +153,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added
- Initial version of Password Manager Backend.

[Unreleased]: https://github.com/silinternational/idp-pw-api/compare/5.5.0...HEAD
[Unreleased]: https://github.com/silinternational/idp-pw-api/compare/5.5.1...HEAD
[5.5.1]: https://github.com/silinternational/idp-pw-api/compare/5.5.0...5.5.1
[5.5.0]: https://github.com/silinternational/idp-pw-api/compare/5.4.0...5.5.0
[5.4.0]: https://github.com/silinternational/idp-pw-api/compare/5.3.4...5.4.0
[5.3.4]: https://github.com/silinternational/idp-pw-api/compare/5.3.3...5.3.4
Expand Down
52 changes: 9 additions & 43 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,53 +1,18 @@
FROM silintl/php7-apache:7.4.19
LABEL maintainer="Phillip Shipley <[email protected]>"
FROM silintl/php7:7.2
MAINTAINER Phillip Shipley <[email protected]>

RUN apt-get update -y && \
apt-get install -y \
# Needed to install s3cmd
python-pip \
# Needed to build php extensions
libfreetype6-dev \
libgmp-dev \
libjpeg62-turbo-dev \
libldap2-dev \
libpng-dev \
libonig-dev \
libxml2-dev \
libzip-dev \
libcurl4-openssl-dev \
# Clean up to reduce docker image size
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN curl https://raw.githubusercontent.com/silinternational/runny/0.2/runny -o /usr/local/bin/runny
RUN chmod a+x /usr/local/bin/runny

# Install and enable, see the README on the docker hub for the image
RUN pecl install memcache-4.0.5.2 && docker-php-ext-enable memcache
RUN docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ && \
docker-php-ext-install gmp ldap zip
ENV REFRESHED_AT 2020-04-07

# Copy in vhost configuration
COPY dockerbuild/vhost.conf /etc/apache2/sites-enabled/
RUN apt-get update -y && \
apt-get install -y php-memcache && \
apt-get clean

# Ensure the DocumentRoot folder exists
RUN mkdir -p /data

# Validate apache configuration
RUN ["apache2ctl", "configtest"]

# Copy in any additional PHP ini files
COPY dockerbuild/*.ini "$PHP_INI_DIR/conf.d/"

# get s3cmd and s3-expand
RUN pip install s3cmd
# get s3-expand
RUN curl https://raw.githubusercontent.com/silinternational/s3-expand/1.5/s3-expand -o /usr/local/bin/s3-expand
RUN chmod a+x /usr/local/bin/s3-expand

# Clean up all the build stuff we don't need
RUN apt purge -y dpkg-dev cpp-8 gcc-8 python2-dev python2.7-dev && \
apt autoremove -y

WORKDIR /data

# Install/cleanup composer dependencies
Expand All @@ -64,12 +29,13 @@ RUN chown -R www-data:www-data \
frontend/runtime/ \
frontend/web/assets/

COPY dockerbuild/vhost.conf /etc/apache2/sites-enabled/

# ErrorLog inside a VirtualHost block is ineffective for unknown reasons
RUN sed -i -E 's@ErrorLog .*@ErrorLog /proc/self/fd/2@i' /etc/apache2/apache2.conf

RUN touch /etc/default/locale

EXPOSE 80
ENTRYPOINT ["/usr/local/bin/s3-expand"]

CMD ["/data/run.sh"]
20 changes: 10 additions & 10 deletions application/common/components/passwordStore/Google.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,20 @@ public function getMeta($employeeId): UserPasswordMeta
* Employee ID.
*
* @param string $employeeId The Employee ID of the desired user.
* @return Google_Service_Directory_User|null The user record from Google.
* @return Google_Service_Directory_User The user record from Google.
* @throws UserNotFoundException if email not defined or user not found in Google
*/
protected function getUser(string $employeeId): ?Google_Service_Directory_User
protected function getUser(string $employeeId): Google_Service_Directory_User
{
$email = $this->getEmailFromLocalStore($employeeId);
$user = $this->getUserByEmail($email);

if ($user === null) {
return $this->getUserByEmployeeId($employeeId);
}
try {
$user = $this->getUserByEmployeeId($employeeId);
} catch (UserNotFoundException $e) {
$email = $this->getEmailFromLocalStore($employeeId);

if (! self::hasCorrectEmployeeId($user, $employeeId)) {
return null;
$user = $this->getUserByEmail($email);
if (! self::hasCorrectEmployeeId($user, $employeeId)) {
throw new UserNotFoundException();
}
}

return $user;
Expand Down
4 changes: 1 addition & 3 deletions application/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ mkdir -p /data/runtime/mail
whenavail ${MYSQL_HOST} 3306 100 /data/yii migrate --interactive=0

# Install and enable xdebug for code coverage
apt-get update && apt-get install -y build-essential
pecl install xdebug
docker-php-ext-enable xdebug
apt-get install -y php-xdebug

# Run codeception tests
whenavail broker 80 100 echo "broker ready, running unit tests..."
Expand Down
4 changes: 1 addition & 3 deletions application/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ runny /data/yii migrate --interactive=0

if [[ $APP_ENV == "dev" ]]; then
export XDEBUG_CONFIG="remote_enable=1 remote_host="$REMOTE_DEBUG_IP
apt-get update && apt-get install -y build-essential
pecl install xdebug
docker-php-ext-enable xdebug
apt-get install php-xdebug
fi

apache2ctl -k start -D FOREGROUND
Expand Down
5 changes: 0 additions & 5 deletions dockerbuild/10-enable-env.ini

This file was deleted.

0 comments on commit 9529fb5

Please sign in to comment.