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

SQL Server migrations fixes and improvements #843

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0123797
Allow configuration of different database connection for all models.
SamMousa May 10, 2017
230b28b
Ensure UserSearch.php works on php <7 again.
thyseus May 14, 2017
c6945ee
Updated italian translation
enricodetoma May 23, 2017
de6bb9e
Fix timezones labels
andrewrbe May 23, 2017
8a827e7
ImpersonateUser fix
bscheshirwork May 24, 2017
3a0fcc7
add username to welcome email
TonisOrmisson May 24, 2017
ad36df8
remove full stop
TonisOrmisson May 24, 2017
db17ebf
Merge pull request #10 from bscheshirwork/patch-3
thyseus May 24, 2017
3934fa8
Merge pull request #8 from enricodetoma/master
thyseus May 24, 2017
36272c7
Merge pull request #9 from andrewrbe/master
thyseus May 24, 2017
c613a77
add login link welcome email (if not via token)
TonisOrmisson May 25, 2017
cfaaf96
fix line breaks
TonisOrmisson May 25, 2017
f93f5ba
typo
TonisOrmisson May 25, 2017
9a1f7c0
Merge pull request #11 from andmemasin/dev-reg-email
thyseus May 26, 2017
3bc40bb
Ensure UserSearch.php works on php <7 again.
thyseus May 26, 2017
38eb496
Some more italian translations
enricodetoma May 28, 2017
5677691
Merge pull request #12 from enricodetoma/feature/italian-translation
thyseus May 28, 2017
7de90e8
Fix for accented letters in italian translation
enricodetoma May 28, 2017
4a8ad42
Merge pull request #13 from enricodetoma/master
thyseus May 29, 2017
cc41d0b
Fixed tests
SamMousa Jun 1, 2017
566137d
Merge remote-tracking branch 'upstream/master' into module-database
SamMousa Jun 1, 2017
0409d1d
Fixed test config for travis
SamMousa Jun 1, 2017
674f1ad
Merge pull request #16 from SAM-IT/module-database
SamMousa Jun 1, 2017
61e4d84
Improved tests (#17)
SamMousa Jun 1, 2017
75ebc03
Prepare for release on packagist.
SamMousa Jun 1, 2017
ffe298b
Filter users by role when possible (#6)
thyseus Jun 5, 2017
a8d4fe9
Fix for bug introduced in UserSearch.php ($query->modelClass::tableNa…
enricodetoma Jun 14, 2017
4805971
Merge pull request #21 from enricodetoma/master
thyseus Jun 14, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ phpunit.phar
tests/_app/config/db.local.php
tests/_support/_generated
tests/_output/*

# composer lock file
composer.lock
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
language: php

php:
- 7.1
- 7.0
- 5.6
- 5.5
- 5.4

services:
- mysql
# environment variable used in test suite
env: TEST_ENVIRONMENT=travis
env: TEST_ENVIRONMENT=travis MYSQL_HOST=localhost MYSQL_USER=root MYSQL_PASSWORD="" MYSQL_DATABASE="dektrium_test"

# faster builds on new travis setup not using sudo
sudo: false
Expand All @@ -21,13 +22,12 @@ cache:
# install dependencies
install:
- travis_retry composer self-update
- travis_retry composer global require "codeception/codeception:2.2.5"
- travis_retry composer global require "fxp/composer-asset-plugin:~1.1.0"
- travis_retry composer install --prefer-dist

before_script:
- mysql -e 'create database dektrium_test;'
- php tests/_app/yii.php migrate --migrationPath=@dektrium/user/migrations --interactive=0
- ~/.composer/vendor/bin/codecept build
- vendor/bin/codecept build

script: ~/.composer/vendor/bin/codecept run
script: vendor/bin/codecept run
7 changes: 7 additions & 0 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,11 @@ class Module extends BaseModule
'recover/<id:\d+>/<code:[A-Za-z0-9_-]+>' => 'recovery/reset',
'settings/<action:\w+>' => 'settings/<action>'
];

/** @var string The database connection to use for models in this module. */
public $dbConnection = 'db';

public function getDb() {
return \Yii::$app->get($this->dbConnection);
}
}
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Yii2-user [![Build Status](https://img.shields.io/travis/dektrium/yii2-user/master.svg?style=flat-square)](https://travis-ci.org/dektrium/yii2-user) [![Packagist Version](https://img.shields.io/packagist/v/dektrium/yii2-user.svg?style=flat-square)](https://packagist.org/packages/dektrium/yii2-user) [![Total Downloads](https://img.shields.io/packagist/dt/dektrium/yii2-user.svg?style=flat-square)](https://packagist.org/packages/dektrium/yii2-user) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
# Yii2-user [![Build Status](https://img.shields.io/travis/dabilite/yii2-user/master.svg?style=flat-square)](https://travis-ci.org/dabilite/yii2-user) [![Packagist Version](https://img.shields.io/packagist/v/dabilite/yii2-user.svg?style=flat-square)](https://packagist.org/packages/dabilite/yii2-user) [![Total Downloads](https://img.shields.io/packagist/dt/dabilite/yii2-user.svg?style=flat-square)](https://packagist.org/packages/dabilite/yii2-user) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)

Most of web applications provide a way for users to register, log in or reset
their forgotten passwords. Rather than re-implementing this on each application,
Expand Down Expand Up @@ -34,6 +34,8 @@ If you have any questions or problems with Yii2-user you can ask them on [our fo

Anyone and everyone is welcome to contribute. Please take a moment to
review the [guidelines for contributing](.github/CONTRIBUTING.md).
Tests can be run locally via docker.
Simply run `docker-compose run --rm functional-tests` and all tests will be run.

## License

Expand Down
24 changes: 15 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,39 @@
{
"name": "dektrium/yii2-user",
"name": "dabilite/yii2-user",
"description": "Flexible user registration and authentication module for Yii2",
"keywords": ["yii2", "yii2-user", "user management", "dektrium"],
"keywords": ["yii2", "yii2-user", "user management", "dektrium", "dabilite"],
"type": "yii2-extension",
"license": "MIT",
"support": {
"issues": "https://github.com/dektrium/yii2-user/issues?state=open",
"forum": "https://gitter.im/dektrium/yii2-user",
"source": "https://github.com/dektrium/yii2-user"
"issues": "https://github.com/dabilite/yii2-user/issues?state=open",
"source": "https://github.com/dabilite/yii2-user"
},
"authors": [
{
"name": "Dmitry Erofeev",
"email": "dmeroff@gmail.com",
"homepage": "http://dmeroff.ru"
},
{
"name": "Sam Mousa",
"email": "sam@mousa.nl",
"homepage": "https://www.linkedin.com/in/sam-mousa-16333820/"
}
],
"minimum-stability": "dev",
"require": {
"yiisoft/yii2": "^2.0.0",
"yiisoft/yii2-swiftmailer": "^2.0.0",
"yiisoft/yii2-authclient": "^2.1.0",
"yiisoft/yii2-bootstrap": "^2.0.0"
"yiisoft/yii2-bootstrap": "^2.0.0",
"codeception/codeception": "^2.3"
},
"require-dev": {
"yiisoft/yii2-codeception": "^2.0.0",
"codeception/specify": "^0.4.3",
"codeception/verify": "^0.3.1"
},
"provide": {
"dektrium/yii2-user": "0.9.12"
},
"autoload": {
"psr-4": {
"dektrium\\user\\": ""
Expand All @@ -40,4 +46,4 @@
"dev-develop": "1.0.x-dev"
}
}
}
}
64 changes: 64 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
version: '2'
services:


## Running tests
functional-tests:
extends: codeception
entrypoint: [
"/sbin/tini",
"--",
"/bin/wait-for-it",
"-h", "$$MYSQL_HOST:3306",
"-t", "100",
"--",
"/project/tests/runtests.sh",
"run functional"
]
depends_on:
- mysql

# entrypoint: "ls /project"

## Running unit tests
unit:
extends: codeception
entrypoint: [
"/sbin/tini",
"--",
"/bin/wait-for-it",
"-h", "$$DB_HOST:3306",
"-t", "100",
"--",
"/project/tests/runtests.sh",
"run unit"
]
depends_on:
- mysql
## Running codeception helper scripts.
codeception:
tty: true
image: sammousa/php-with-extensions
entrypoint: ["/sbin/tini", "--", "/project/tests/runtests.sh"]
volumes:
- ./:/project
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_USER: dabilite
MYSQL_PASSWORD: testpass
MYSQL_DATABASE: test
# We set this to keep compatibility between gitlab-ci and docker compose
RUNNER_IP: web
MYSQL_HOST: mysql
YII_ENV: "test"
## Mysql server (local)
mysql:
image: mysql:5.7.14
tmpfs:
- /var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_USER: dabilite
MYSQL_PASSWORD: testpass
MYSQL_DATABASE: test

5 changes: 3 additions & 2 deletions helpers/Timezone.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ public static function getAll()

foreach ($timeZoneIdentifiers as $timeZone) {
$date = new \DateTime('now', new \DateTimeZone($timeZone));
$offset = $date->getOffset() / 60 / 60;
$offset = $date->getOffset();
$tz = ($offset > 0 ? '+' : '-') . gmdate('H:i', abs($offset));
$timeZones[] = [
'timezone' => $timeZone,
'name' => "{$timeZone} (UTC " . ($offset > 0 ? '+' : '') . "{$offset})",
'name' => "{$timeZone} (UTC " . "{$tz})",
'offset' => $offset
];
}
Expand Down
1 change: 1 addition & 0 deletions messages/de/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
'An error occurred processing your request' => 'Ein Fehler ist aufgetreten',
'Assignments' => 'Zuordnungen',
'Are you sure you want to switch to this user for the rest of this Session?' => 'Sind Sie sicher, dass sie für den Rest der Sitzung zu diesem Benutzer wechseln möchten?',
'Auth item' => 'Berechtigung',
'Awesome, almost there. Now you need to click the confirmation link sent to your new email address' => 'Fast geschafft. Nun müssen Sie nur noch den Aktivierungslink besuchen, der an ihre neue E-Mail Adresse gesendet wurde',
'Awesome, almost there. Now you need to click the confirmation link sent to your old email address' => 'Fast geschafft. Nun müssen Sie nur noch den Aktivierungslink besuchen, der an ihre alte E-Mail Adresse gesendet wurde',
'Become this user' => 'Zu diesem Nutzer wechseln',
Expand Down