├── .bowerrc ├── .gitignore ├── .htaccess ├── LICENSE ├── README.md ├── backend ├── assets │ └── AppAsset.php ├── codeception.yml ├── config │ ├── .gitignore │ ├── bootstrap.php │ ├── main.php │ ├── params.php │ └── test.php ├── controllers │ ├── NewsController.php │ ├── PageController.php │ ├── SiteController.php │ └── SliderController.php ├── models │ └── .gitkeep ├── runtime │ └── .gitignore ├── tests │ ├── _bootstrap.php │ ├── _data │ │ ├── .gitignore │ │ └── login_data.php │ ├── _output │ │ └── .gitignore │ ├── _support │ │ ├── .gitignore │ │ ├── FunctionalTester.php │ │ └── UnitTester.php │ ├── functional.suite.yml │ ├── functional │ │ ├── LoginCest.php │ │ └── _bootstrap.php │ ├── unit.suite.yml │ └── unit │ │ └── _bootstrap.php ├── views │ ├── layouts │ │ ├── content.php │ │ ├── header.php │ │ ├── left.php │ │ ├── main-login.php │ │ └── main.php │ ├── news │ │ ├── _form.php │ │ ├── _search.php │ │ ├── create.php │ │ ├── index.php │ │ ├── update.php │ │ └── view.php │ ├── page │ │ ├── _form.php │ │ ├── _search.php │ │ ├── create.php │ │ ├── index.php │ │ ├── update.php │ │ └── view.php │ ├── sign-in │ │ ├── account.php │ │ ├── login.php │ │ └── profile.php │ ├── site │ │ ├── error.php │ │ ├── index.php │ │ └── orderHistory.php │ ├── slider │ │ ├── _form.php │ │ ├── _search.php │ │ ├── create.php │ │ ├── index.php │ │ ├── update.php │ │ └── view.php │ └── user │ │ ├── _form.php │ │ ├── _search.php │ │ ├── create.php │ │ ├── index.php │ │ ├── security │ │ └── login.php │ │ ├── update.php │ │ └── view.php └── web │ ├── .gitignore │ ├── .htaccess │ ├── assets │ └── .gitignore │ ├── css │ └── site.css │ ├── favicon.png │ ├── images │ └── placeHolder.png │ └── robots.txt ├── codeception.yml ├── common ├── aspects │ ├── OrderFilling.php │ ├── SetCertificateDiscount.php │ ├── SetDiscount.php │ └── UseCertificate.php ├── codeception.yml ├── config │ ├── .gitignore │ ├── bootstrap.php │ ├── main-local_dist.php │ ├── main.php │ ├── params-local_dist.php │ ├── params.php │ └── test.php ├── fixtures │ └── User.php ├── mail │ └── layouts │ │ ├── html.php │ │ └── text.php ├── messages │ ├── es │ │ ├── backend.php │ │ ├── common.php │ │ └── frontend.php │ ├── ru │ │ ├── backend.php │ │ ├── common.php │ │ └── frontend.php │ ├── uk │ │ ├── backend.php │ │ ├── common.php │ │ └── frontend.php │ └── zh │ │ ├── backend.php │ │ ├── common.php │ │ └── frontend.php ├── models │ ├── News.php │ ├── Page.php │ ├── Slider.php │ └── search │ │ ├── NewsSearch.php │ │ ├── PageSearch.php │ │ └── SliderSearch.php ├── modules │ └── dektrium │ │ ├── yii2-rbac │ │ ├── Bootstrap.php │ │ ├── CHANGELOG.md │ │ ├── LICENSE.md │ │ ├── README.md │ │ ├── RbacConsoleModule.php │ │ ├── RbacWebModule.php │ │ ├── UPGRADE.md │ │ ├── commands │ │ │ └── MigrateController.php │ │ ├── components │ │ │ ├── DbManager.php │ │ │ └── ManagerInterface.php │ │ ├── composer.json │ │ ├── controllers │ │ │ ├── AssignmentController.php │ │ │ ├── ItemControllerAbstract.php │ │ │ ├── PermissionController.php │ │ │ ├── RoleController.php │ │ │ └── RuleController.php │ │ ├── messages │ │ │ ├── de │ │ │ │ └── rbac.php │ │ │ ├── et │ │ │ │ └── rbac.php │ │ │ ├── fa-IR │ │ │ │ └── rbac.php │ │ │ ├── fi │ │ │ │ └── rbac.php │ │ │ ├── fr │ │ │ │ └── rbac.php │ │ │ ├── it │ │ │ │ └── rbac.php │ │ │ ├── lv │ │ │ │ └── rbac.php │ │ │ ├── message.php │ │ │ ├── nl │ │ │ │ └── rbac.php │ │ │ ├── pt-BR │ │ │ │ └── rbac.php │ │ │ ├── ru │ │ │ │ └── rbac.php │ │ │ └── uk │ │ │ │ └── rbac.php │ │ ├── migrations │ │ │ ├── .gitkeep │ │ │ └── Migration.php │ │ ├── models │ │ │ ├── Assignment.php │ │ │ ├── AuthItem.php │ │ │ ├── Permission.php │ │ │ ├── Role.php │ │ │ ├── Rule.php │ │ │ ├── RuleSearch.php │ │ │ └── Search.php │ │ ├── validators │ │ │ └── RbacValidator.php │ │ ├── views │ │ │ ├── layout.php │ │ │ ├── migration.php │ │ │ ├── permission │ │ │ │ ├── _form.php │ │ │ │ ├── create.php │ │ │ │ ├── index.php │ │ │ │ └── update.php │ │ │ ├── role │ │ │ │ ├── _form.php │ │ │ │ ├── create.php │ │ │ │ ├── index.php │ │ │ │ └── update.php │ │ │ └── rule │ │ │ │ ├── _form.php │ │ │ │ ├── create.php │ │ │ │ ├── index.php │ │ │ │ └── update.php │ │ └── widgets │ │ │ ├── Assignments.php │ │ │ ├── Menu.php │ │ │ └── views │ │ │ └── form.php │ │ └── yii2-user │ │ ├── Bootstrap.php │ │ ├── CHANGELOG.md │ │ ├── Finder.php │ │ ├── LICENSE.md │ │ ├── Mailer.php │ │ ├── Module.php │ │ ├── README.md │ │ ├── UPGRADE.md │ │ ├── clients │ │ ├── ClientInterface.php │ │ ├── Facebook.php │ │ ├── GitHub.php │ │ ├── Google.php │ │ ├── LinkedIn.php │ │ ├── Twitter.php │ │ ├── VKontakte.php │ │ └── Yandex.php │ │ ├── codeception.yml │ │ ├── commands │ │ ├── ConfirmController.php │ │ ├── CreateController.php │ │ ├── DeleteController.php │ │ └── PasswordController.php │ │ ├── controllers │ │ ├── AdminController.php │ │ ├── ProfileController.php │ │ ├── RecoveryController.php │ │ ├── RegistrationController.php │ │ ├── SecurityController.php │ │ └── SettingsController.php │ │ ├── docs │ │ ├── README.md │ │ ├── adding-captcha.md │ │ ├── adding-new-field-to-user-model.md │ │ ├── adding-profile-fields-to-registration-form.md │ │ ├── available-actions.md │ │ ├── configuration.md │ │ ├── console.md │ │ ├── custom-access-control.md │ │ ├── data-model.md │ │ ├── faq.md │ │ ├── getting-started.md │ │ ├── mailer.md │ │ ├── overriding-controllers.md │ │ ├── overriding-models.md │ │ ├── overriding-views.md │ │ ├── social-auth.md │ │ ├── troubleshooting.md │ │ ├── usage-with-advanced-template.md │ │ ├── user-management.md │ │ ├── using-controller-events.md │ │ └── yii2-rbac.md │ │ ├── events │ │ ├── AuthEvent.php │ │ ├── ConnectEvent.php │ │ ├── FormEvent.php │ │ ├── ProfileEvent.php │ │ ├── ResetPasswordEvent.php │ │ └── UserEvent.php │ │ ├── filters │ │ ├── AccessRule.php │ │ ├── BackendFilter.php │ │ └── FrontendFilter.php │ │ ├── helpers │ │ ├── Password.php │ │ └── Timezone.php │ │ ├── messages │ │ ├── ca │ │ │ └── user.php │ │ ├── da │ │ │ └── user.php │ │ ├── de-DU │ │ │ └── user.php │ │ ├── de │ │ │ └── user.php │ │ ├── es │ │ │ └── user.php │ │ ├── et │ │ │ └── user.php │ │ ├── fa-IR │ │ │ └── user.php │ │ ├── fi │ │ │ └── user.php │ │ ├── fr │ │ │ └── user.php │ │ ├── hr │ │ │ └── user.php │ │ ├── hu │ │ │ └── user.php │ │ ├── it │ │ │ └── user.php │ │ ├── ja │ │ │ └── user.php │ │ ├── kz │ │ │ └── user.php │ │ ├── lt │ │ │ └── user.php │ │ ├── lv │ │ │ └── user.php │ │ ├── message.php │ │ ├── nl │ │ │ └── user.php │ │ ├── pl │ │ │ └── user.php │ │ ├── pt-BR │ │ │ └── user.php │ │ ├── pt-PT │ │ │ └── user.php │ │ ├── ro │ │ │ └── user.php │ │ ├── ru │ │ │ └── user.php │ │ ├── th │ │ │ └── user.php │ │ ├── tr_TR │ │ │ └── user.php │ │ ├── uk │ │ │ └── user.php │ │ ├── vi │ │ │ └── user.php │ │ └── zh-CN │ │ │ └── user.php │ │ ├── migrations │ │ ├── Migration.php │ │ ├── m140209_132017_init.php │ │ ├── m140403_174025_create_account_table.php │ │ ├── m140504_113157_update_tables.php │ │ ├── m140504_130429_create_token_table.php │ │ ├── m140830_171933_fix_ip_field.php │ │ ├── m140830_172703_change_account_table_name.php │ │ ├── m141222_110026_update_ip_field.php │ │ ├── m141222_135246_alter_username_length.php │ │ ├── m150614_103145_update_social_account_table.php │ │ ├── m150623_212711_fix_username_notnull.php │ │ ├── m151218_234654_add_timezone_to_profile.php │ │ └── m160929_103127_add_last_login_at_to_user_table.php │ │ ├── models │ │ ├── Account.php │ │ ├── LoginForm.php │ │ ├── Profile.php │ │ ├── RecoveryForm.php │ │ ├── RegistrationForm.php │ │ ├── ResendForm.php │ │ ├── SettingsForm.php │ │ ├── Token.php │ │ ├── User.php │ │ ├── UserSearch.php │ │ └── query │ │ │ └── AccountQuery.php │ │ ├── tests │ │ ├── _app │ │ │ ├── config │ │ │ │ ├── console.php │ │ │ │ ├── db.php │ │ │ │ └── test.php │ │ │ ├── controllers │ │ │ │ └── SiteController.php │ │ │ ├── views │ │ │ │ ├── layouts │ │ │ │ │ └── main.php │ │ │ │ └── site │ │ │ │ │ └── index.php │ │ │ └── yii.php │ │ ├── _bootstrap.php │ │ ├── _fixtures │ │ │ ├── ProfileFixture.php │ │ │ ├── TokenFixture.php │ │ │ ├── UserFixture.php │ │ │ └── data │ │ │ │ ├── profile.php │ │ │ │ ├── token.php │ │ │ │ └── user.php │ │ ├── _output │ │ │ └── .gitignore │ │ ├── _pages │ │ │ ├── AdminPage.php │ │ │ ├── CreatePage.php │ │ │ ├── LoginPage.php │ │ │ ├── RecoveryPage.php │ │ │ ├── RegistrationPage.php │ │ │ ├── ResendPage.php │ │ │ ├── SettingsPage.php │ │ │ └── UpdatePage.php │ │ ├── _support │ │ │ ├── FunctionalTester.php │ │ │ └── UnitTester.php │ │ ├── functional.suite.yml │ │ ├── functional │ │ │ ├── ConfirmationCept.php │ │ │ ├── CreateCept.php │ │ │ ├── LoginCept.php │ │ │ ├── RecoveryCept.php │ │ │ ├── RegistrationCest.php │ │ │ ├── ResendCept.php │ │ │ ├── SettingsCept.php │ │ │ ├── UpdateCept.php │ │ │ └── _bootstrap.php │ │ ├── unit.suite.yml │ │ └── unit │ │ │ └── _bootstrap.php │ │ ├── traits │ │ ├── AjaxValidationTrait.php │ │ ├── EventTrait.php │ │ └── ModuleTrait.php │ │ ├── views │ │ ├── _alert.php │ │ ├── admin │ │ │ ├── _account.php │ │ │ ├── _assignments.php │ │ │ ├── _info.php │ │ │ ├── _menu.php │ │ │ ├── _profile.php │ │ │ ├── _user.php │ │ │ ├── create.php │ │ │ ├── index.php │ │ │ └── update.php │ │ ├── mail │ │ │ ├── confirmation.php │ │ │ ├── layouts │ │ │ │ ├── html.php │ │ │ │ └── text.php │ │ │ ├── new_password.php │ │ │ ├── reconfirmation.php │ │ │ ├── recovery.php │ │ │ ├── text │ │ │ │ ├── confirmation.php │ │ │ │ ├── new_password.php │ │ │ │ ├── reconfirmation.php │ │ │ │ ├── recovery.php │ │ │ │ └── welcome.php │ │ │ └── welcome.php │ │ ├── message.php │ │ ├── profile │ │ │ └── show.php │ │ ├── recovery │ │ │ ├── request.php │ │ │ └── reset.php │ │ ├── registration │ │ │ ├── connect.php │ │ │ ├── register.php │ │ │ └── resend.php │ │ ├── security │ │ │ └── login.php │ │ └── settings │ │ │ ├── _menu.php │ │ │ ├── account.php │ │ │ ├── networks.php │ │ │ └── profile.php │ │ └── widgets │ │ ├── Connect.php │ │ ├── Login.php │ │ └── views │ │ └── login.php ├── tests │ ├── _bootstrap.php │ ├── _data │ │ └── user.php │ ├── _output │ │ └── .gitignore │ ├── _support │ │ ├── .gitignore │ │ └── UnitTester.php │ ├── unit.suite.yml │ └── unit │ │ └── models │ │ └── LoginFormTest.php └── widgets │ └── Alert.php ├── composer.json ├── composer.lock ├── console ├── config │ ├── .gitignore │ ├── bootstrap.php │ ├── main-local_dist.php │ ├── main.php │ ├── params-local_dist.php │ └── params.php ├── controllers │ └── .gitkeep ├── migrations │ ├── m170317_090004_news.php │ ├── m170317_090025_slider.php │ └── m170317_090234_page.php ├── models │ └── .gitkeep └── runtime │ └── .gitignore ├── environments ├── dev │ ├── backend │ │ ├── config │ │ │ ├── main-local.php │ │ │ ├── params-local.php │ │ │ └── test-local.php │ │ └── web │ │ │ ├── index-test.php │ │ │ └── index.php │ ├── common │ │ └── config │ │ │ ├── main-local.php │ │ │ ├── params-local.php │ │ │ └── test-local.php │ ├── console │ │ └── config │ │ │ ├── main-local.php │ │ │ └── params-local.php │ ├── frontend │ │ ├── config │ │ │ ├── main-local.php │ │ │ ├── params-local.php │ │ │ └── test-local.php │ │ └── web │ │ │ ├── index-test.php │ │ │ └── index.php │ ├── yii │ ├── yii_test │ └── yii_test.bat ├── index.php └── prod │ ├── backend │ ├── config │ │ ├── main-local.php │ │ └── params-local.php │ └── web │ │ └── index.php │ ├── common │ └── config │ │ ├── main-local.php │ │ └── params-local.php │ ├── console │ └── config │ │ ├── main-local.php │ │ └── params-local.php │ ├── frontend │ ├── config │ │ ├── main-local.php │ │ └── params-local.php │ └── web │ │ └── index.php │ └── yii ├── frontend ├── assets │ └── AppAsset.php ├── codeception.yml ├── config │ ├── .gitignore │ ├── bootstrap.php │ ├── main-local_dist.php │ ├── main.php │ ├── params-local_dist.php │ ├── params.php │ └── test.php ├── controllers │ └── SiteController.php ├── models │ └── ContactForm.php ├── runtime │ └── .gitignore ├── tests │ ├── _bootstrap.php │ ├── _data │ │ ├── login_data.php │ │ └── user.php │ ├── _output │ │ └── .gitignore │ ├── _support │ │ ├── .gitignore │ │ ├── FunctionalTester.php │ │ └── UnitTester.php │ ├── acceptance.suite.yml.example │ ├── acceptance │ │ ├── HomeCest.php │ │ └── _bootstrap.php │ ├── functional.suite.yml │ ├── functional │ │ ├── AboutCest.php │ │ ├── ContactCest.php │ │ ├── HomeCest.php │ │ ├── LoginCest.php │ │ ├── SignupCest.php │ │ └── _bootstrap.php │ ├── unit.suite.yml │ └── unit │ │ ├── _bootstrap.php │ │ └── models │ │ ├── ContactFormTest.php │ │ ├── PasswordResetRequestFormTest.php │ │ ├── ResetPasswordFormTest.php │ │ └── SignupFormTest.php ├── views │ ├── layouts │ │ └── main.php │ └── site │ │ ├── about.php │ │ ├── contact.php │ │ ├── error.php │ │ ├── index.php │ │ └── thanks.php └── web │ ├── .gitignore │ ├── .htaccess │ ├── assets │ └── .gitignore │ ├── css │ └── site.css │ ├── favicon.ico │ ├── images │ └── placeHolder.png │ └── robots.txt ├── init ├── init.bat ├── migrate.sh ├── migrations ├── m170418_170456_register_user.php ├── m170425_150102_base_migration.php └── m170426_174712_insert_user_role.php ├── requirements.php ├── robots.txt ├── yii └── yii.bat /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory" : "vendor/bower" 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # yii console commands 2 | /yii_test 3 | /yii_test.bat 4 | 5 | # phpstorm project files 6 | .idea 7 | 8 | # netbeans project files 9 | nbproject 10 | 11 | # zend studio for eclipse project files 12 | .buildpath 13 | .project 14 | .settings 15 | 16 | # windows thumbnail cache 17 | Thumbs.db 18 | 19 | # composer vendor dir 20 | /vendor 21 | 22 | # composer itself is not needed 23 | composer.phar 24 | 25 | # Mac DS_Store Files 26 | .DS_Store 27 | 28 | # phpunit itself is not needed 29 | phpunit.phar 30 | # local phpunit config 31 | /phpunit.xml 32 | 33 | # vagrant runtime 34 | /.vagrant 35 | 36 | /frontend/web/images/cache/* 37 | /frontend/web/images/source/* 38 | /frontend/web/images/store/* 39 | /frontend/runtime/* 40 | /backend/runtime/* 41 | /console/runtime/* 42 | /common/runtime/* -------------------------------------------------------------------------------- /.htaccess: -------------------------------------------------------------------------------- 1 | Options +FollowSymLinks 2 | IndexIgnore */* 3 | RewriteEngine on 4 | 5 | # Если запрос начинается с /admin, то заменяем на /backend/web/ 6 | RewriteCond %{REQUEST_URI} ^/admin 7 | RewriteRule ^admin\/?(.*) /backend/web/$1 8 | 9 | # Добавляем другой запрос /frontend/web/$1 10 | RewriteCond %{REQUEST_URI} !^/(frontend/web|backend/web|admin) 11 | RewriteRule (.*) /frontend/web/$1 12 | 13 | # Если frontend запрос 14 | RewriteCond %{REQUEST_URI} ^/frontend/web 15 | RewriteCond %{REQUEST_FILENAME} !-f 16 | RewriteCond %{REQUEST_FILENAME} !-d 17 | RewriteRule . /frontend/web/index.php 18 | 19 | # Если backend запрос 20 | RewriteCond %{REQUEST_URI} ^/backend/web 21 | RewriteCond %{REQUEST_FILENAME} !-f 22 | RewriteCond %{REQUEST_FILENAME} !-d 23 | RewriteRule . /backend/web/index.php 24 | -------------------------------------------------------------------------------- /backend/assets/AppAsset.php: -------------------------------------------------------------------------------- 1 | 'admin@example.com', 4 | ]; 5 | -------------------------------------------------------------------------------- /backend/config/test.php: -------------------------------------------------------------------------------- 1 | 'app-backend-tests', 4 | ]; 5 | -------------------------------------------------------------------------------- /backend/models/.gitkeep: -------------------------------------------------------------------------------- 1 | * 2 | -------------------------------------------------------------------------------- /backend/runtime/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /backend/tests/_bootstrap.php: -------------------------------------------------------------------------------- 1 | 'erau', 5 | 'auth_key' => 'tUu1qHcde0diwUol3xeI-18MuHkkprQI', 6 | // password_0 7 | 'password_hash' => '$2y$13$nJ1WDlBaGcbCdbNC5.5l4.sgy.OMEKCqtDQOdQ2OWpgiKRWYyzzne', 8 | 'password_reset_token' => 'RkD_Jw0_8HEedzLk7MM-ZKEFfYR7VbMr_1392559490', 9 | 'created_at' => '1392559490', 10 | 'updated_at' => '1392559490', 11 | 'email' => 'sfriesen@jenkins.info', 12 | ], 13 | ]; 14 | -------------------------------------------------------------------------------- /backend/tests/_output/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /backend/tests/_support/.gitignore: -------------------------------------------------------------------------------- 1 | _generated 2 | -------------------------------------------------------------------------------- /backend/tests/_support/FunctionalTester.php: -------------------------------------------------------------------------------- 1 | haveFixtures([ 16 | 'user' => [ 17 | 'class' => UserFixture::className(), 18 | 'dataFile' => codecept_data_dir() . 'login_data.php' 19 | ] 20 | ]); 21 | } 22 | /** 23 | * @param FunctionalTester $I 24 | */ 25 | public function loginUser(FunctionalTester $I) 26 | { 27 | $I->amOnPage('/site/login'); 28 | $I->fillField('Username', 'erau'); 29 | $I->fillField('Password', 'password_0'); 30 | $I->click('login-button'); 31 | 32 | $I->see('Logout (erau)', 'form button[type=submit]'); 33 | $I->dontSeeLink('Login'); 34 | $I->dontSeeLink('Signup'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /backend/tests/functional/_bootstrap.php: -------------------------------------------------------------------------------- 1 | 10 | beginPage() ?> 11 | 12 | 13 | 14 | 15 | 16 | 17 | <?= Html::encode($this->title) ?> 18 | head() ?> 19 | 20 | 21 | 22 | beginBody() ?> 23 | 24 | 25 | 26 | endBody() ?> 27 | 28 | 29 | endPage() ?> 30 | -------------------------------------------------------------------------------- /backend/views/news/_search.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | 40 | -------------------------------------------------------------------------------- /backend/views/news/create.php: -------------------------------------------------------------------------------- 1 | title = 'Добавить новость'; 10 | $this->params['breadcrumbs'][] = ['label' => 'Новости', 'url' => ['index']]; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 |

title) ?>

16 | 17 | render('_form', [ 18 | 'model' => $model, 19 | ]) ?> 20 | 21 |
22 | -------------------------------------------------------------------------------- /backend/views/news/update.php: -------------------------------------------------------------------------------- 1 | title = 'Редактировать Новость: ' . $model->name; 9 | $this->params['breadcrumbs'][] = ['label' => 'Новости', 'url' => ['index']]; 10 | $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; 11 | $this->params['breadcrumbs'][] = 'Редактировать'; 12 | ?> 13 |
14 | 15 |

title) ?>

16 | 17 | render('_form', [ 18 | 'model' => $model, 19 | ]) ?> 20 | 21 |
22 | -------------------------------------------------------------------------------- /backend/views/news/view.php: -------------------------------------------------------------------------------- 1 | title = $model->name; 10 | $this->params['breadcrumbs'][] = ['label' => 'Новости', 'url' => ['index']]; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 |

title) ?>

16 | 17 |

18 | $model->id], ['class' => 'btn btn-primary']) ?> 19 | $model->id], [ 20 | 'class' => 'btn btn-danger', 21 | 'data' => [ 22 | 'confirm' => 'Вы уверены, что хотите удалить этот элемент?', 23 | 'method' => 'post', 24 | ], 25 | ]) ?> 26 |

27 | 28 | $model, 30 | 'attributes' => [ 31 | 'id', 32 | 'name', 33 | 'anons', 34 | 'text:ntext', 35 | 'slug', 36 | 'date', 37 | [ 38 | 'attribute' =>'status', 39 | 'format' => 'raw', 40 | 'value' => function($model){ 41 | $translate =['draft' => 'Черновик','published' => 'Опубликовано', 'deleted' => 'Удалено']; 42 | return $translate[$model ->status]; 43 | } 44 | ], 45 | ], 46 | ]) ?> 47 | 48 |
49 | -------------------------------------------------------------------------------- /backend/views/page/_search.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | 34 | -------------------------------------------------------------------------------- /backend/views/page/create.php: -------------------------------------------------------------------------------- 1 | title = 'Создать страницу'; 10 | $this->params['breadcrumbs'][] = ['label' => 'Страницы', 'url' => ['index']]; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 | render('_form', [ 16 | 'model' => $model, 17 | ]) ?> 18 | 19 |
20 | -------------------------------------------------------------------------------- /backend/views/page/index.php: -------------------------------------------------------------------------------- 1 | title = 'Страницы'; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 |

16 | 'btn btn-success']) ?> 17 |

18 | 19 | $dataProvider, 21 | 'filterModel' => $searchModel, 22 | 'columns' => [ 23 | ['class' => 'yii\grid\SerialColumn'], 24 | // 'id', 25 | 'name', 26 | //'slug', 27 | [ 28 | 'attribute' => 'show', 29 | 'format' => 'raw', 30 | 'value' => function($model){ 31 | $translate =['1' => 'Да','0' => 'Нет']; 32 | return $translate[$model ->top_menu]; 33 | } 34 | ], 35 | 'sort', 36 | ['class' => 'yii\grid\ActionColumn', 'template' => '{update} {delete}'], 37 | ], 38 | ]); ?> 39 |
40 | -------------------------------------------------------------------------------- /backend/views/page/update.php: -------------------------------------------------------------------------------- 1 | title = 'Редактировать страницу: ' . $model->title; 9 | $this->params['breadcrumbs'][] = ['label' => 'Страницы', 'url' => ['index']]; 10 | $this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]]; 11 | $this->params['breadcrumbs'][] = 'Редактирование'; 12 | ?> 13 |
14 | 15 | render('_form', [ 16 | 'model' => $model, 17 | ]) ?> 18 | 19 |
20 | -------------------------------------------------------------------------------- /backend/views/page/view.php: -------------------------------------------------------------------------------- 1 | title = $model->title; 10 | $this->params['breadcrumbs'][] = ['label' => 'Страницы', 'url' => ['index']]; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 |

title) ?>

16 | 17 |

18 | $model->id], ['class' => 'btn btn-primary']) ?> 19 | $model->id], [ 20 | 'class' => 'btn btn-danger', 21 | 'data' => [ 22 | 'confirm' => 'Вы уверены, что хотите удалить этот элемент?', 23 | 'method' => 'post', 24 | ], 25 | ]) ?> 26 |

27 | 28 | $model, 30 | 'attributes' => [ 31 | 'id', 32 | [ 33 | 'attribute' =>'top_menu', 34 | 'format' => 'raw', 35 | 'value' => function($model){ 36 | $translate =['1' => 'Да','0' => 'Нет']; 37 | return $translate[$model ->top_menu]; 38 | } 39 | ], 40 | 'slug', 41 | 'title', 42 | 'text:ntext', 43 | ], 44 | ]) ?> 45 | 46 |
47 | -------------------------------------------------------------------------------- /backend/views/sign-in/account.php: -------------------------------------------------------------------------------- 1 | title = 'Аккаунт'; 10 | ?> 11 | 12 |
13 | 14 | 15 | 16 | field($model, 'username') ?> 17 | 18 | field($model, 'email') ?> 19 | 20 | field($model, 'password')->passwordInput()->label('Новый пароль') ?> 21 | 22 | field($model, 'password_confirm')->passwordInput()->label('Новый пароль еще раз') ?> 23 | 24 |
25 | 'btn btn-primary']) ?> 26 |
27 | 28 | 29 | 30 |
31 | -------------------------------------------------------------------------------- /backend/views/sign-in/login.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('backend', 'Sign In'); 10 | $this->params['breadcrumbs'][] = $this->title; 11 | $this->params['body-class'] = 'login-page'; 12 | ?> 13 |
14 | 17 |
18 |
19 | 'login-form']); ?> 20 |
21 | field($model, 'username') ?> 22 | field($model, 'password')->passwordInput() ?> 23 | field($model, 'rememberMe')->checkbox(['class'=>'simple']) ?> 24 |
25 | 31 | 32 |
33 | 34 |
-------------------------------------------------------------------------------- /backend/views/sign-in/profile.php: -------------------------------------------------------------------------------- 1 | title = 'Редактирование профиля'; 12 | ?> 13 | 14 |
15 | 16 | 17 | 18 | field($model, 'firstname')->textInput(['maxlength' => 255]) ?> 19 | 20 | field($model, 'middlename')->textInput(['maxlength' => 255]) ?> 21 | 22 | field($model, 'lastname')->textInput(['maxlength' => 255]) ?> 23 | 24 | field($model, 'gender')->dropDownlist([ 25 | UserProfile::GENDER_FEMALE => 'Женщина', 26 | UserProfile::GENDER_MALE => 'Мужчина', 27 | ]) ?> 28 | 29 |
30 | 'btn btn-primary']) ?> 31 |
32 | 33 | 34 | 35 |
36 | -------------------------------------------------------------------------------- /backend/views/site/error.php: -------------------------------------------------------------------------------- 1 | title = $name; 11 | ?> 12 |
13 | 14 |

title) ?>

15 | 16 |
17 | 18 |
19 | 20 |

21 | The above error occurred while the Web server was processing your request. 22 |

23 |

24 | Please contact us if you think this is a server error. Thank you. 25 |

26 | 27 |
28 | -------------------------------------------------------------------------------- /backend/views/site/index.php: -------------------------------------------------------------------------------- 1 | title = 'Главная' 7 | ?> 8 |
9 |
10 |
11 | 12 |
13 |
14 | 15 |
16 |
17 |
18 | -------------------------------------------------------------------------------- /backend/views/slider/_search.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | 34 | -------------------------------------------------------------------------------- /backend/views/slider/create.php: -------------------------------------------------------------------------------- 1 | title = 'Создать слайдер'; 10 | $this->params['breadcrumbs'][] = ['label' => 'Слайдеры', 'url' => ['index']]; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 |

title) ?>

16 | 17 | render('_form', [ 18 | 'model' => $model, 19 | ]) ?> 20 | 21 |
22 | -------------------------------------------------------------------------------- /backend/views/slider/index.php: -------------------------------------------------------------------------------- 1 | title = 'Слайдер'; 12 | $this->params['breadcrumbs'][] = $this->title; 13 | ?> 14 |
15 | 16 |

17 | 'btn btn-success']) ?> 18 |

19 | 20 | $dataProvider, 22 | 'filterModel' => $searchModel, 23 | 'columns' => [ 24 | ['class' => 'yii\grid\SerialColumn'], 25 | 26 | 'name', 27 | 28 | ['label' => 'Изображение', 'content' => function($model){ 29 | return ""; 30 | } ], 31 | 32 | 'url:url', 33 | 'short_text', 34 | 'sort', 35 | 36 | ['class' => 'yii\grid\ActionColumn', 'template' => '{update} {delete}'], 37 | ], 38 | ]); 39 | ?> 40 |
41 | -------------------------------------------------------------------------------- /backend/views/slider/update.php: -------------------------------------------------------------------------------- 1 | title = 'Редактирование Слайда: ' . $model->id; 9 | $this->params['breadcrumbs'][] = ['label' => 'Слайдеры', 'url' => ['index']]; 10 | $this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]]; 11 | $this->params['breadcrumbs'][] = 'Редактирование'; 12 | ?> 13 |
14 | 15 | render('_form', [ 16 | 'model' => $model, 17 | ]) ?> 18 | 19 |
20 | -------------------------------------------------------------------------------- /backend/views/slider/view.php: -------------------------------------------------------------------------------- 1 | title = $model->id; 10 | $this->params['breadcrumbs'][] = ['label' => 'Слайдеры', 'url' => ['index']]; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 |

title) ?>

16 | 17 |
18 | $model->id], ['class' => 'btn btn-primary']) ?> 19 | $model->id], [ 20 | 'class' => 'btn btn-danger', 21 | 'data' => [ 22 | 'confirm' => 'Вы уверены, что хотите удалить этот элемент?', 23 | 'method' => 'post', 24 | ], 25 | ]) ?> 26 |
27 | 28 |
29 | id); 31 | echo ""; 32 | ?> 33 |
34 | 35 | $model, 37 | 'attributes' => [ 38 | 'id', 39 | 'url:url', 40 | 'short_text', 41 | 'sort', 42 | ], 43 | ]) ?> 44 | 45 |
46 | -------------------------------------------------------------------------------- /backend/views/user/_search.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | 42 | -------------------------------------------------------------------------------- /backend/views/user/create.php: -------------------------------------------------------------------------------- 1 | title = 'Добавить пользователя'; 6 | $this->params['breadcrumbs'][] = ['label' => 'Пользователи', 'url' => ['index']]; 7 | $this->params['breadcrumbs'][] = $this->title; 8 | ?> 9 |
10 | 11 | render('_form', [ 12 | 'model' => $model, 13 | 'roles' => $roles 14 | ]) ?> 15 | 16 |
17 | -------------------------------------------------------------------------------- /backend/views/user/index.php: -------------------------------------------------------------------------------- 1 | title = 'Пользователи'; 12 | $this->params['breadcrumbs'][] = $this->title; 13 | ?> 14 |
15 | 16 | render('_search', ['model' => $searchModel]); ?> 17 | 18 |

19 | 'btn btn-success']) ?> 20 |

21 | 22 | $dataProvider, 24 | 'filterModel' => $searchModel, 25 | 'columns' => [ 26 | 'id', 27 | 'username', 28 | 'phone', 29 | 'email:email', 30 | 'status', 31 | 'created_at:datetime', 32 | 'logged_at:datetime', 33 | // 'updated_at', 34 | 35 | ['class' => 'yii\grid\ActionColumn', 'template' => '{update} {delete}', 'buttonOptions' => ['class' => 'btn btn-default'], 'options' => ['style' => 'width: 145px;']], 36 | ], 37 | ]); ?> 38 | 39 |
40 | -------------------------------------------------------------------------------- /backend/views/user/update.php: -------------------------------------------------------------------------------- 1 | title = 'Изменить пользователя' . ' ' . $model->username; 10 | $this->params['breadcrumbs'][] = ['label' => 'Пользователи', 'url' => ['index']]; 11 | $this->params['breadcrumbs'][] = ['label'=>'Изменить']; 12 | ?> 13 |
14 | 15 | render('_form', [ 16 | 'model' => $model, 17 | 'profile' => $profile, 18 | 'roles' => $roles 19 | ]) ?> 20 | 21 |
22 | -------------------------------------------------------------------------------- /backend/views/user/view.php: -------------------------------------------------------------------------------- 1 | title = $model->getPublicIdentity(); 10 | $this->params['breadcrumbs'][] = ['label' => Yii::t('backend', 'Users'), 'url' => ['index']]; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 |

16 | $model->id], ['class' => 'btn btn-primary']) ?> 17 | $model->id], [ 18 | 'class' => 'btn btn-danger', 19 | 'data' => [ 20 | 'confirm' => Yii::t('backend', 'Are you sure you want to delete this item?'), 21 | 'method' => 'post', 22 | ], 23 | ]) ?> 24 |

25 | 26 | $model, 28 | 'attributes' => [ 29 | 'id', 30 | 'username', 31 | 'auth_key', 32 | 'email:email', 33 | 'status', 34 | 'created_at:datetime', 35 | 'updated_at:datetime', 36 | 'logged_at:datetime', 37 | ], 38 | ]) ?> 39 | 40 | $model]);?> 41 | 42 |
43 | -------------------------------------------------------------------------------- /backend/web/.gitignore: -------------------------------------------------------------------------------- 1 | /index.php 2 | /index-test.php 3 | -------------------------------------------------------------------------------- /backend/web/.htaccess: -------------------------------------------------------------------------------- 1 | RewriteEngine On 2 | 3 | RewriteCond %{REQUEST_FILENAME} !-f 4 | RewriteCond %{REQUEST_FILENAME} !-d 5 | 6 | RewriteRule . index.php -------------------------------------------------------------------------------- /backend/web/assets/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /backend/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dvizh/shop-skeleton/15fec9b64567cedd4eb9b04271ee41f36440ed5e/backend/web/favicon.png -------------------------------------------------------------------------------- /backend/web/images/placeHolder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dvizh/shop-skeleton/15fec9b64567cedd4eb9b04271ee41f36440ed5e/backend/web/images/placeHolder.png -------------------------------------------------------------------------------- /backend/web/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: / 3 | -------------------------------------------------------------------------------- /codeception.yml: -------------------------------------------------------------------------------- 1 | # global codeception file to run tests from all apps 2 | include: 3 | - common 4 | - frontend 5 | - backend 6 | paths: 7 | log: console/runtime/logs 8 | settings: 9 | colors: true -------------------------------------------------------------------------------- /common/aspects/OrderFilling.php: -------------------------------------------------------------------------------- 1 | 'putElements' 13 | ]; 14 | } 15 | 16 | public function putElements($event) 17 | { 18 | $order = $event->model; 19 | 20 | foreach(yii::$app->cart->elements as $element) { 21 | $elementModel = new Element; 22 | 23 | $elementModel->setOrderId($order->id); 24 | $elementModel->setAssigment($order->is_assigment); 25 | $elementModel->setModelName($element->getModelName()); 26 | $elementModel->setName($element->getName()); 27 | $elementModel->setItemId($element->getItemId()); 28 | $elementModel->setCount($element->getCount()); 29 | $elementModel->setBasePrice($element->getPrice(false)); 30 | $elementModel->setPrice($element->getPrice()); 31 | $elementModel->setOptions(json_encode($element->getOptions())); 32 | $elementModel->setDescription(''); 33 | $elementModel->saveData(); 34 | } 35 | 36 | $order->base_cost = 0; 37 | $order->cost = 0; 38 | 39 | foreach($order->elements as $element) { 40 | $order->base_cost += ($element->base_price*$element->count); 41 | $order->cost += ($element->price*$element->count); 42 | } 43 | $order->save(); 44 | 45 | yii::$app->cart->truncate(); 46 | } 47 | } -------------------------------------------------------------------------------- /common/aspects/SetDiscount.php: -------------------------------------------------------------------------------- 1 | eventName; 13 | return [ 14 | $eventName => 'doDiscount' 15 | ]; 16 | } 17 | 18 | public function doDiscount($event) 19 | { 20 | if(yii::$app->promocode->has()) { 21 | 22 | if (!yii::$app->promocode->get()->promocode->getTransactions()->all() && yii::$app->promocode->get()->promocode->type == 'cumulative') { 23 | $discount = 0; 24 | } else { 25 | $discount = yii::$app->promocode->get()->promocode->discount; 26 | } 27 | 28 | if (yii::$app->promocode->get()->promocode->type == 'percent' || yii::$app->promocode->get()->promocode->type == 'cumulative' || empty(yii::$app->promocode->get()->promocode->type)) { 29 | if($discount > 0 && $discount <= 100 && $event->cost > 0) { 30 | $event->cost = $event->cost-($event->cost*$discount)/100; 31 | } 32 | } else { 33 | if($discount > 0 && $event->cost > 0) { 34 | if ($event->cost < $discount) { 35 | $event->cost = $event->cost-($event->cost*100)/100; 36 | } else { 37 | $event->cost = $event->cost-$discount; 38 | } 39 | } 40 | } 41 | } 42 | return $this; 43 | } 44 | } -------------------------------------------------------------------------------- /common/codeception.yml: -------------------------------------------------------------------------------- 1 | namespace: common\tests 2 | actor: Tester 3 | paths: 4 | tests: tests 5 | log: tests/_output 6 | data: tests/_data 7 | helpers: tests/_support 8 | settings: 9 | bootstrap: _bootstrap.php 10 | colors: true 11 | memory_limit: 1024M 12 | modules: 13 | config: 14 | Yii2: 15 | configFile: 'config/test-local.php' 16 | -------------------------------------------------------------------------------- /common/config/.gitignore: -------------------------------------------------------------------------------- 1 | main-local.php 2 | params-local.php 3 | test-local.php 4 | -------------------------------------------------------------------------------- /common/config/bootstrap.php: -------------------------------------------------------------------------------- 1 | [ 4 | 'db' => [ 5 | 'class' => 'yii\db\Connection', 6 | 'dsn' => 'mysql:host=localhost;dbname=partner1', 7 | 'username' => 'root', 8 | 'password' => 'root', 9 | 'charset' => 'utf8', 10 | ], 11 | 'mailer' => [ 12 | 'class' => 'yii\swiftmailer\Mailer', 13 | 'viewPath' => '@common/mail', 14 | // send all mails to a file by default. You have to set 15 | // 'useFileTransport' to false and configure a transport 16 | // for the mailer to send real emails. 17 | 'useFileTransport' => true, 18 | ], 19 | ], 20 | ]; 21 | -------------------------------------------------------------------------------- /common/config/params-local_dist.php: -------------------------------------------------------------------------------- 1 | 'admin@example.com', 4 | 'supportEmail' => 'support@example.com', 5 | 'user.passwordResetTokenExpire' => 3600, 6 | ]; 7 | -------------------------------------------------------------------------------- /common/config/test.php: -------------------------------------------------------------------------------- 1 | 'app-common-tests', 4 | 'basePath' => dirname(__DIR__), 5 | 'components' => [ 6 | 'user' => [ 7 | 'class' => 'yii\web\User', 8 | 'identityClass' => 'common\models\User', 9 | ], 10 | ], 11 | ]; 12 | -------------------------------------------------------------------------------- /common/fixtures/User.php: -------------------------------------------------------------------------------- 1 | 8 | beginPage() ?> 9 | 10 | 11 | 12 | 13 | <?= Html::encode($this->title) ?> 14 | head() ?> 15 | 16 | 17 | beginBody() ?> 18 | 19 | endBody() ?> 20 | 21 | 22 | endPage() ?> 23 | -------------------------------------------------------------------------------- /common/mail/layouts/text.php: -------------------------------------------------------------------------------- 1 | 9 | 10 | beginPage() ?> 11 | beginBody() ?> 12 | 13 | endBody() ?> 14 | endPage() ?> 15 | -------------------------------------------------------------------------------- /common/models/News.php: -------------------------------------------------------------------------------- 1 | [ 13 | 'class' => 'Zelenin\yii\behaviors\Slug', 14 | ], 15 | ]; 16 | } 17 | 18 | /** 19 | * @inheritdoc 20 | */ 21 | public static function tableName() 22 | { 23 | return 'news'; 24 | } 25 | 26 | /** 27 | * @inheritdoc 28 | */ 29 | public function rules() 30 | { 31 | return [ 32 | [['name', 'anons', 'text'], 'required'], 33 | [['text', 'status'], 'string'], 34 | [['date'], 'safe'], 35 | [['name', 'slug'], 'string', 'max' => 55], 36 | [['anons'], 'string', 'max' => 300], 37 | ]; 38 | } 39 | 40 | /** 41 | * @inheritdoc 42 | */ 43 | public function attributeLabels() 44 | { 45 | return [ 46 | 'id' => 'ID', 47 | 'name' => 'Заголовок', 48 | 'anons' => 'Анонс', 49 | 'text' => 'Текст', 50 | 'slug' => 'Seo-заголовок', 51 | 'date' => 'Дата', 52 | 'status' => 'Статус', 53 | ]; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /common/models/Page.php: -------------------------------------------------------------------------------- 1 | [ 13 | 'class' => 'Zelenin\yii\behaviors\Slug', 14 | ], 15 | ]; 16 | } 17 | 18 | /** 19 | * @inheritdoc 20 | */ 21 | public static function tableName() 22 | { 23 | return 'page'; 24 | } 25 | 26 | /** 27 | * @inheritdoc 28 | */ 29 | public function rules() 30 | { 31 | return [ 32 | [[ 'name', 'text'], 'required'], 33 | [['text','show_page', 'template'], 'string'], 34 | [['slug', 'name'], 'string', 'max' => 255], 35 | ]; 36 | } 37 | 38 | /** 39 | * @inheritdoc 40 | */ 41 | public function attributeLabels() 42 | { 43 | return [ 44 | 'id' => 'ID', 45 | 'show_page' => 'Показывать в главном меню', 46 | 'slug' => 'SEO-имя', 47 | 'name' => 'Заголовок', 48 | 'text' => 'Текст', 49 | ]; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /common/models/Slider.php: -------------------------------------------------------------------------------- 1 | [ 21 | 'class' => 'dvizh\gallery\behaviors\AttachImages', 22 | ], 23 | ]; 24 | } 25 | 26 | /** 27 | * @inheritdoc 28 | */ 29 | public static function tableName() 30 | { 31 | return 'slider'; 32 | } 33 | 34 | /** 35 | * @inheritdoc 36 | */ 37 | public function rules() 38 | { 39 | return [ 40 | [['sort'], 'integer'], 41 | [['url', 'short_text', 'name'], 'string', 'max' => 255], 42 | ]; 43 | } 44 | 45 | /** 46 | * @inheritdoc 47 | */ 48 | public function attributeLabels() 49 | { 50 | return [ 51 | 'id' => 'ID', 52 | 'name' => 'Название', 53 | 'url' => 'Ссылка', 54 | 'short_text' => 'Краткое описание', 55 | 'sort' => 'Порядок', 56 | ]; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # CHANGELOG 2 | 3 | ## 1.0.0-alpha August 15, 2016 4 | 5 | - Enh: Invalidate cache after saving auth items/rules (dmeroff) 6 | - New #77: Added migrate console command (dmeroff) 7 | - New: Module's class has been renamed from `dektrium\rbac\Module` to `dektrium\rbac\RbacWebModule` (dmeroff) 8 | - Enh #9: Added ability to manage rules (dmeroff) 9 | - Enh: Updated grid views (dmeroff) 10 | - Enh: Added check if rule has name property set (dmeroff) 11 | - Bug #21: Added loop check while creating unassigned items list (dmeroff) 12 | - Chg: Bumped required Yii2 version to 2.0.8 (dmeroff) 13 | - New #71: Added ability to set auth item data when creating/updating roles/permissions (dmeroff) 14 | - Chg: Removed `enableFlashMessages` option (see UPGRADE.md for details) (dmeroff) 15 | 16 | ## 0.3.0 March 30, 2016 17 | 18 | - New #54: Added admin access via rbac permission (Talwoasc) 19 | - Enh: Updated translations 20 | 21 | ## 0.2.0 December 5, 2015 22 | 23 | Some fixes and improvements 24 | 25 | ## 0.1.0 June 14, 2015 26 | 27 | Initial release 28 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/README.md: -------------------------------------------------------------------------------- 1 | # Yii2-rbac [![Total Downloads](https://img.shields.io/packagist/dt/dektrium/yii2-rbac.svg?style=flat-square)](https://packagist.org/packages/dektrium/yii2-rbac) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) 2 | 3 | Yii2-rbac provides a way to manage your application's RBAC structure and includes following features: 4 | 5 | - Allows CRUD operations for auth items (roles and permissions) and rules. 6 | - Allows to assign multiple roles or permissions to user (using bundled widget). 7 | - Allows to create console migration for creating/updating RBAC items. 8 | - Integrated with [Yii2-user](https://github.com/dektrium/yii2-user) - flexible user management module 9 | 10 | > **NOTE:** Module is in initial development. Anything may change at any time. 11 | 12 | ## Documentation 13 | 14 | [Read the Documentation for master](docs/README.md) 15 | 16 | [Read the Documentation for v1.0.0-alpha](https://github.com/dektrium/yii2-rbac/blob/1.0.0-alpha/docs/README.md) 17 | 18 | ## Support 19 | 20 | If you have any questions or problems with Yii2-rbac you can ask them on [our forum](http://dektrium.com). 21 | 22 | ## Contributing to this project 23 | 24 | Anyone and everyone is welcome to contribute. Please take a moment to review the 25 | [guidelines for contributing](.github/CONTRIBUTING.md). 26 | 27 | ## License 28 | 29 | Yii2-rbac is released under the MIT License. See the bundled [LICENSE.md](LICENSE.md) for details. 30 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/RbacConsoleModule.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class RbacConsoleModule extends Module 13 | { 14 | /** 15 | * @inheritdoc 16 | */ 17 | public $controllerNamespace = 'dektrium\rbac\commands'; 18 | } -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/UPGRADE.md: -------------------------------------------------------------------------------- 1 | # Upgrading instructions for Yii2-rbac 2 | 3 | The following upgrading instructions are cumulative. That is, if you want to 4 | upgrade from version A to version C and there is version B between A and C, you 5 | need to following the instructions for both A and B. 6 | 7 | ## Upgrade from Yii2-rbac 0.3.* to Yii2-rbac 1.0.0 8 | 9 | - Module's class has been renamed from `dektrium\rbac\Module` to `dektrium\rbac\RbacWebModule`. You have to update your 10 | config files accordingly. 11 | 12 | - Module's option `enableFlashMessages` has been removed. If you've used it you should remove it from your config. This 13 | also means that module won't show any flash messages. You have to use your own widget to display flash messages. 14 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/components/ManagerInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\rbac\components; 13 | 14 | use yii\rbac\ManagerInterface as BaseManagerInterface; 15 | 16 | /** 17 | * @author Dmitry Erofeev 18 | */ 19 | interface ManagerInterface extends BaseManagerInterface 20 | { 21 | /** 22 | * @param integer|null $type 23 | * @param array $excludeItems 24 | * @return mixed 25 | */ 26 | public function getItems($type = null, $excludeItems = []); 27 | 28 | /** 29 | * @param integer $userId 30 | * @return mixed 31 | */ 32 | public function getItemsByUser($userId); 33 | 34 | /** 35 | * @param string $name 36 | * @return mixed 37 | */ 38 | public function getItem($name); 39 | } -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dektrium/yii2-rbac", 3 | "description": "RBAC management module for Yii2", 4 | "keywords": ["yii2", "yii2-rbac", "rbac management", "dektrium", "rbac gui", "yii rbac", "rbac module"], 5 | "type": "yii2-extension", 6 | "license": "MIT", 7 | "support": { 8 | "issues": "https://github.com/dektrium/yii2-rbac/issues?state=open", 9 | "source": "https://github.com/dektrium/yii2-rbac" 10 | }, 11 | "authors": [ 12 | { 13 | "name": "Dmitry Erofeev", 14 | "email": "dmeroff@gmail.com", 15 | "homepage": "http://dmeroff.ru" 16 | } 17 | ], 18 | "minimum-stability": "dev", 19 | "require": { 20 | "yiisoft/yii2": "^2.0.8", 21 | "kartik-v/yii2-widget-select2": "^2.0" 22 | }, 23 | "autoload": { 24 | "psr-4": { 25 | "dektrium\\rbac\\": "" 26 | } 27 | }, 28 | "extra": { 29 | "bootstrap": "dektrium\\rbac\\Bootstrap", 30 | "branch-alias": { 31 | "dev-master": "1.0.x-dev" 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/controllers/AssignmentController.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\rbac\controllers; 13 | 14 | use dektrium\rbac\models\Assignment; 15 | use Yii; 16 | use yii\web\Controller; 17 | 18 | /** 19 | * @author Dmitry Erofeev 20 | */ 21 | class AssignmentController extends Controller 22 | { 23 | /** 24 | * Show form with auth items for user. 25 | * 26 | * @param int $id 27 | */ 28 | public function actionAssign($id) 29 | { 30 | $model = Yii::createObject([ 31 | 'class' => Assignment::className(), 32 | 'user_id' => $id, 33 | ]); 34 | 35 | if ($model->load(\Yii::$app->request->post()) && $model->updateAssignments()) { 36 | } 37 | 38 | return \dektrium\rbac\widgets\Assignments::widget([ 39 | 'model' => $model, 40 | ]); 41 | /*$model = Yii::createObject([ 42 | 'class' => Assignment::className(), 43 | 'user_id' => $id, 44 | ]); 45 | 46 | if ($model->load(Yii::$app->request->post()) && $model->updateAssignments()) { 47 | 48 | } 49 | 50 | return $this->render('assign', [ 51 | 'model' => $model, 52 | ]);*/ 53 | } 54 | } -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/controllers/PermissionController.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\rbac\controllers; 13 | 14 | use yii\rbac\Permission; 15 | use yii\web\NotFoundHttpException; 16 | use yii\rbac\Item; 17 | 18 | /** 19 | * @author Dmitry Erofeev 20 | */ 21 | class PermissionController extends ItemControllerAbstract 22 | { 23 | /** @var string */ 24 | protected $modelClass = 'dektrium\rbac\models\Permission'; 25 | 26 | /** @var int */ 27 | protected $type = Item::TYPE_PERMISSION; 28 | 29 | /** @inheritdoc */ 30 | protected function getItem($name) 31 | { 32 | $role = \Yii::$app->authManager->getPermission($name); 33 | 34 | if ($role instanceof Permission) { 35 | return $role; 36 | } 37 | 38 | throw new NotFoundHttpException; 39 | } 40 | } -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/controllers/RoleController.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\rbac\controllers; 13 | 14 | use yii\rbac\Role; 15 | use yii\web\NotFoundHttpException; 16 | use yii\rbac\Item; 17 | 18 | /** 19 | * @author Dmitry Erofeev 20 | */ 21 | class RoleController extends ItemControllerAbstract 22 | { 23 | /** @var string */ 24 | protected $modelClass = 'dektrium\rbac\models\Role'; 25 | 26 | protected $type = Item::TYPE_ROLE; 27 | 28 | /** @inheritdoc */ 29 | protected function getItem($name) 30 | { 31 | $role = \Yii::$app->authManager->getRole($name); 32 | 33 | if ($role instanceof Role) { 34 | return $role; 35 | } 36 | 37 | throw new NotFoundHttpException; 38 | } 39 | } -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/messages/message.php: -------------------------------------------------------------------------------- 1 | __DIR__ . '/../', 5 | 'messagePath' => __DIR__, 6 | 'languages' => [ 7 | 'de', 8 | 'fa-IR', 9 | 'fi', 10 | 'fr', 11 | 'it', 12 | 'nl', 13 | 'pt-BR', 14 | 'ru', 15 | 'uk', 16 | ], 17 | 'translator' => 'Yii::t', 18 | 'sort' => false, 19 | 'overwrite' => true, 20 | 'removeUnused' => false, 21 | 'only' => ['*.php'], 22 | 'except' => [ 23 | '.svn', 24 | '.git', 25 | '.gitignore', 26 | '.gitkeep', 27 | '.hgignore', 28 | '.hgkeep', 29 | '/messages', 30 | '/tests', 31 | '/vendor', 32 | ], 33 | 'format' => 'php', 34 | ]; 35 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/migrations/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dvizh/shop-skeleton/15fec9b64567cedd4eb9b04271ee41f36440ed5e/common/modules/dektrium/yii2-rbac/migrations/.gitkeep -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/models/Permission.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\rbac\models; 13 | use yii\helpers\ArrayHelper; 14 | use yii\rbac\Item; 15 | 16 | /** 17 | * @author Dmitry Erofeev 18 | */ 19 | class Permission extends AuthItem 20 | { 21 | /** 22 | * @inheritdoc 23 | */ 24 | public function getUnassignedItems() 25 | { 26 | return ArrayHelper::map($this->manager->getItems(Item::TYPE_PERMISSION, $this->item !== null ? [$this->item->name] : []), 'name', function ($item) { 27 | return empty($item->description) ? $item->name : $item->name . ' (' . $item->description . ')'; 28 | }); 29 | } 30 | 31 | /** 32 | * @inheritdoc 33 | */ 34 | protected function createItem($name) 35 | { 36 | return $this->manager->createPermission($name); 37 | } 38 | } -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/models/Role.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\rbac\models; 13 | 14 | use yii\rbac\Item; 15 | 16 | /** 17 | * @author Dmitry Erofeev 18 | */ 19 | class Role extends AuthItem 20 | { 21 | /** 22 | * @inheritdoc 23 | */ 24 | public function getUnassignedItems() 25 | { 26 | $data = []; 27 | $items = $this->manager->getItems(null, $this->item !== null ? [$this->item->name] : []); 28 | 29 | if ($this->item === null) { 30 | foreach ($items as $item) { 31 | $data[$item->name] = $this->formatName($item); 32 | } 33 | } else { 34 | foreach ($items as $item) { 35 | if ($this->manager->canAddChild($this->item, $item)) { 36 | $data[$item->name] = $this->formatName($item); 37 | } 38 | } 39 | } 40 | 41 | return $data; 42 | } 43 | 44 | /** 45 | * Formats name. 46 | * 47 | * @param Item $item 48 | * @return string 49 | */ 50 | protected function formatName(Item $item) 51 | { 52 | return empty($item->description) ? $item->name : $item->name . ' (' . $item->description . ')'; 53 | } 54 | 55 | /** 56 | * @inheritdoc 57 | */ 58 | protected function createItem($name) 59 | { 60 | return $this->manager->createRole($name); 61 | } 62 | } -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/validators/RbacValidator.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\rbac\validators; 13 | 14 | use yii\validators\Validator; 15 | 16 | /** 17 | * @author Dmitry Erofeev 18 | */ 19 | class RbacValidator extends Validator 20 | { 21 | /** @var \dektrium\rbac\components\DbManager */ 22 | protected $manager; 23 | 24 | /** @inheritdoc */ 25 | public function init() 26 | { 27 | parent::init(); 28 | $this->manager = \Yii::$app->authManager; 29 | } 30 | 31 | /** @inheritdoc */ 32 | protected function validateValue($value) 33 | { 34 | if (!is_array($value)) { 35 | return [\Yii::t('rbac', 'Invalid value'), []]; 36 | } 37 | 38 | foreach ($value as $val) { 39 | if ($this->manager->getItem($val) == null) { 40 | return [\Yii::t('rbac', 'There is neither role nor permission with name "{0}"', [$val]), []]; 41 | } 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/views/layout.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | /** 13 | * @var $this yii\web\View 14 | * @var $content string 15 | */ 16 | 17 | use dektrium\rbac\widgets\Menu; 18 | 19 | ?> 20 | 21 | 22 | 23 |
24 | 25 |
-------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/views/migration.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | /** 13 | * @var string $className the new migration class name 14 | */ 15 | 16 | echo " 18 | 19 | use dektrium\rbac\migrations\Migration; 20 | 21 | class extends Migration 22 | { 23 | public function safeUp() 24 | { 25 | 26 | } 27 | 28 | public function safeDown() 29 | { 30 | echo " cannot be reverted.\n"; 31 | 32 | return false; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/views/permission/create.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | /** 13 | * @var $model dektrium\rbac\models\Role 14 | * @var $this yii\web\View 15 | */ 16 | 17 | $this->title = Yii::t('rbac', 'Create new permission'); 18 | $this->params['breadcrumbs'][] = $this->title; 19 | 20 | ?> 21 | 22 | beginContent('@dektrium/rbac/views/layout.php') ?> 23 | 24 | render('_form', [ 25 | 'model' => $model, 26 | ]) ?> 27 | 28 | endContent() ?> 29 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/views/permission/update.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | /** 13 | * @var $model dektrium\rbac\models\Role 14 | * @var $this yii\web\View 15 | */ 16 | 17 | $this->title = Yii::t('rbac', 'Update permission'); 18 | $this->params['breadcrumbs'][] = $this->title; 19 | 20 | ?> 21 | 22 | beginContent('@dektrium/rbac/views/layout.php') ?> 23 | 24 | render('_form', [ 25 | 'model' => $model, 26 | ]) ?> 27 | 28 | endContent() ?> -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/views/role/create.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | /** 13 | * @var $model dektrium\rbac\models\Role 14 | * @var $this yii\web\View 15 | */ 16 | 17 | $this->title = Yii::t('rbac', 'Create new role'); 18 | $this->params['breadcrumbs'][] = $this->title; 19 | 20 | ?> 21 | 22 | beginContent('@dektrium/rbac/views/layout.php') ?> 23 | 24 | render('_form', [ 25 | 'model' => $model, 26 | ]) ?> 27 | 28 | endContent() ?> -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/views/role/update.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | /** 13 | * @var $model dektrium\rbac\models\Role 14 | * @var $this yii\web\View 15 | */ 16 | 17 | $this->title = Yii::t('rbac', 'Update role'); 18 | $this->params['breadcrumbs'][] = $this->title; 19 | 20 | ?> 21 | 22 | beginContent('@dektrium/rbac/views/layout.php') ?> 23 | 24 | render('_form', [ 25 | 'model' => $model, 26 | ]) ?> 27 | 28 | endContent() ?> -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/views/rule/_form.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | /** 13 | * @var $this \yii\web\View 14 | * @var $model \dektrium\rbac\models\Rule 15 | */ 16 | 17 | use yii\widgets\ActiveForm; 18 | use yii\helpers\Html; 19 | 20 | ?> 21 | 22 | false, 24 | 'enableAjaxValidation' => true, 25 | ]) ?> 26 | 27 | field($model, 'name') ?> 28 | 29 | field($model, 'class') ?> 30 | 31 | 'btn btn-success btn-block']) ?> 32 | 33 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/views/rule/create.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | /** 13 | * @var $model \dektrium\rbac\models\Rule 14 | * @var $this \yii\web\View 15 | */ 16 | 17 | $this->title = Yii::t('rbac', 'Create rule'); 18 | $this->params['breadcrumbs'][] = ['label' => Yii::t('rbac', 'Rules'), 'url' => ['index']]; 19 | $this->params['breadcrumbs'][] = $this->title; 20 | 21 | ?> 22 | 23 | beginContent('@dektrium/rbac/views/layout.php') ?> 24 | 25 | render('_form', [ 26 | 'model' => $model, 27 | ]) ?> 28 | 29 | endContent() ?> 30 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/views/rule/update.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | /** 13 | * @var $model \dektrium\rbac\models\Rule 14 | * @var $this \yii\web\View 15 | */ 16 | 17 | $this->title = Yii::t('rbac', 'Update rule'); 18 | $this->params['breadcrumbs'][] = ['label' => Yii::t('rbac', 'Rules'), 'url' => ['index']]; 19 | $this->params['breadcrumbs'][] = $this->title; 20 | 21 | ?> 22 | 23 | beginContent('@dektrium/rbac/views/layout.php') ?> 24 | 25 | render('_form', [ 26 | 'model' => $model, 27 | ]) ?> 28 | 29 | endContent() ?> 30 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-rbac/widgets/views/form.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use dektrium\rbac\models\Assignment; 13 | use kartik\select2\Select2; 14 | use yii\bootstrap\Alert; 15 | use yii\helpers\Html; 16 | use yii\widgets\ActiveForm; 17 | 18 | /** 19 | * @var $model Assignment 20 | */ 21 | 22 | ?> 23 | 24 | updated): ?> 25 | 26 | [ 28 | 'class' => 'alert-success' 29 | ], 30 | 'body' => Yii::t('rbac', 'Assignments have been updated'), 31 | ]) ?> 32 | 33 | 34 | 35 | false, 37 | 'enableAjaxValidation' => false, 38 | ]) ?> 39 | 40 | 41 | 42 | field($model, 'items')->widget(Select2::className(), [ 43 | 'data' => $model->getAvailableItems(), 44 | 'options' => [ 45 | 'id' => 'items', 46 | 'multiple' => true 47 | ], 48 | ]) ?> 49 | 50 | 'btn btn-success btn-block']) ?> 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2016 Dektrium project 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/clients/ClientInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\user\clients; 13 | 14 | use yii\authclient\ClientInterface as BaseInterface; 15 | 16 | /** 17 | * Enhances default yii client interface by adding methods that can be used to 18 | * get user's email and username. 19 | * 20 | * @author Dmitry Erofeev 21 | */ 22 | interface ClientInterface extends BaseInterface 23 | { 24 | /** @return string|null User's email */ 25 | public function getEmail(); 26 | 27 | /** @return string|null User's username */ 28 | public function getUsername(); 29 | } 30 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/clients/Facebook.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\user\clients; 13 | 14 | use yii\authclient\clients\Facebook as BaseFacebook; 15 | 16 | /** 17 | * @author Dmitry Erofeev 18 | */ 19 | class Facebook extends BaseFacebook implements ClientInterface 20 | { 21 | /** @inheritdoc */ 22 | public function getEmail() 23 | { 24 | return isset($this->getUserAttributes()['email']) 25 | ? $this->getUserAttributes()['email'] 26 | : null; 27 | } 28 | 29 | /** @inheritdoc */ 30 | public function getUsername() 31 | { 32 | return; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/clients/GitHub.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\user\clients; 13 | 14 | use yii\authclient\clients\GitHub as BaseGitHub; 15 | 16 | /** 17 | * @author Dmitry Erofeev 18 | */ 19 | class GitHub extends BaseGitHub implements ClientInterface 20 | { 21 | /** @inheritdoc */ 22 | public function getEmail() 23 | { 24 | return isset($this->getUserAttributes()['email']) 25 | ? $this->getUserAttributes()['email'] 26 | : null; 27 | } 28 | 29 | /** @inheritdoc */ 30 | public function getUsername() 31 | { 32 | return isset($this->getUserAttributes()['login']) 33 | ? $this->getUserAttributes()['login'] 34 | : null; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/clients/Google.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\user\clients; 13 | 14 | use yii\authclient\clients\Google as BaseGoogle; 15 | 16 | /** 17 | * @author Dmitry Erofeev 18 | */ 19 | class Google extends BaseGoogle implements ClientInterface 20 | { 21 | /** @inheritdoc */ 22 | public function getEmail() 23 | { 24 | return isset($this->getUserAttributes()['emails'][0]['value']) 25 | ? $this->getUserAttributes()['emails'][0]['value'] 26 | : null; 27 | } 28 | 29 | /** @inheritdoc */ 30 | public function getUsername() 31 | { 32 | return; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/clients/LinkedIn.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\user\clients; 13 | 14 | use yii\authclient\clients\LinkedIn as BaseLinkedIn; 15 | 16 | /** 17 | * @author Sam Mousa 18 | */ 19 | class LinkedIn extends BaseLinkedIn implements ClientInterface 20 | { 21 | /** @inheritdoc */ 22 | public function getEmail() 23 | { 24 | return isset($this->getUserAttributes()['email-address']) 25 | ? $this->getUserAttributes()['email-address'] 26 | : null; 27 | } 28 | 29 | /** @inheritdoc */ 30 | public function getUsername() 31 | { 32 | return; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/clients/Twitter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\user\clients; 13 | 14 | use yii\authclient\clients\Twitter as BaseTwitter; 15 | use yii\helpers\ArrayHelper; 16 | 17 | /** 18 | * @author Dmitry Erofeev 19 | */ 20 | class Twitter extends BaseTwitter implements ClientInterface 21 | { 22 | /** 23 | * @return string 24 | */ 25 | public function getUsername() 26 | { 27 | return ArrayHelper::getValue($this->getUserAttributes(), 'screen_name'); 28 | } 29 | 30 | /** 31 | * @return null Twitter does not provide user's email address 32 | */ 33 | public function getEmail() 34 | { 35 | return null; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/clients/VKontakte.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\user\clients; 13 | 14 | use Yii; 15 | use yii\authclient\clients\VKontakte as BaseVKontakte; 16 | 17 | /** 18 | * @author Dmitry Erofeev 19 | */ 20 | class VKontakte extends BaseVKontakte implements ClientInterface 21 | { 22 | /** @inheritdoc */ 23 | public $scope = 'email'; 24 | 25 | /** @inheritdoc */ 26 | public function getEmail() 27 | { 28 | return $this->getAccessToken()->getParam('email'); 29 | } 30 | 31 | /** @inheritdoc */ 32 | public function getUsername() 33 | { 34 | return isset($this->getUserAttributes()['screen_name']) 35 | ? $this->getUserAttributes()['screen_name'] 36 | : null; 37 | } 38 | 39 | /** @inheritdoc */ 40 | protected function defaultTitle() 41 | { 42 | return Yii::t('user', 'VKontakte'); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/clients/Yandex.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\user\clients; 13 | 14 | use Yii; 15 | use yii\authclient\clients\Yandex as BaseYandex; 16 | 17 | /** 18 | * @author Dmitry Erofeev 19 | */ 20 | class Yandex extends BaseYandex implements ClientInterface 21 | { 22 | /** @inheritdoc */ 23 | public function getEmail() 24 | { 25 | $emails = isset($this->getUserAttributes()['emails']) 26 | ? $this->getUserAttributes()['emails'] 27 | : null; 28 | 29 | if ($emails !== null && isset($emails[0])) { 30 | return $emails[0]; 31 | } else { 32 | return null; 33 | } 34 | } 35 | 36 | /** @inheritdoc */ 37 | public function getUsername() 38 | { 39 | return isset($this->getUserAttributes()['login']) 40 | ? $this->getUserAttributes()['login'] 41 | : null; 42 | } 43 | 44 | /** @inheritdoc */ 45 | protected function defaultTitle() 46 | { 47 | return Yii::t('user', 'Yandex'); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/codeception.yml: -------------------------------------------------------------------------------- 1 | actor: Tester 2 | paths: 3 | tests: tests 4 | log: tests/_output 5 | data: tests/_data 6 | helpers: tests/_support 7 | settings: 8 | bootstrap: _bootstrap.php 9 | colors: true 10 | memory_limit: 1024M 11 | modules: 12 | config: 13 | Yii2: 14 | configFile: 'tests/_app/config/test.php' 15 | coverage: 16 | enabled: true 17 | include: 18 | - ../clients/* 19 | - ../controllers/* 20 | - ../events/* 21 | - ../filters/* 22 | - ../helpers/* 23 | - ../models/* 24 | - ../traits/* 25 | - ../views/* 26 | - ../widgets/* 27 | - ../Bootstrap.php 28 | - ../Module.php 29 | - ../Mailer.php 30 | - ../Finder.php -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/docs/README.md: -------------------------------------------------------------------------------- 1 | # Guide to Yii2-user 2 | 3 | Yii2-user documentation is licensed under the [CC BY 4.0](http://creativecommons.org/licenses/by/4.0/). 4 | 5 | © [Dektrium project](http://github.com/dektrium/) 2013 - 2016 6 | 7 | ## Getting Started 8 | 9 | - [Installation](getting-started.md) 10 | - [Configuration](configuration.md) 11 | - [List of available actions](available-actions.md) 12 | - [Troubleshooting](troubleshooting.md) 13 | - [Usage with Yii2 advanced template](usage-with-advanced-template.md) 14 | - [Console commands](console.md) 15 | - [F.A.Q.](faq.md) 16 | 17 | ## Overriding 18 | 19 | - [Overriding models](overriding-models.md) 20 | - [Overriding views](overriding-views.md) 21 | - [Using controller events](using-controller-events.md) 22 | - [Overriding controllers](overriding-controllers.md) 23 | 24 | ## Basics 25 | 26 | - [User management](user-management.md) 27 | - [Authentication via social networks](social-auth.md) 28 | - [Mailer](mailer.md) 29 | - [Data model](data-model.md) 30 | 31 | ## RBAC 32 | 33 | - [Powerful RBAC with Yii2-rbac](yii2-rbac.md) 34 | - [Simpler RBAC with access control filter](custom-access-control.md) 35 | 36 | ## Guides 37 | 38 | - [How to add captcha](adding-captcha.md) 39 | - [How to add custom field to User model](adding-new-field-to-user-model.md) 40 | - [How to add Profile field to the registration form](adding-profile-fields-to-registration-form.md) 41 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/docs/custom-access-control.md: -------------------------------------------------------------------------------- 1 | # Simpler RBAC using custom access control filter 2 | 3 | Yii2-user comes with access control rule which adds support of `admin` role which allows access to users 4 | added to `admins` property of the module. 5 | 6 | ## Apply filter to your controller 7 | 8 | Here is an example of how to use access rule in your access control filter: 9 | 10 | ```php 11 | [ 26 | 'class' => AccessControl::className(), 27 | 'ruleConfig' => [ 28 | 'class' => AccessRule::className(), 29 | ], 30 | 'rules' => [ 31 | [ 32 | 'actions' => ['create'], 33 | 'allow' => true, 34 | 'roles' => ['admin'], 35 | ], 36 | [ 37 | 'actions' => ['view', 'search'], 38 | 'allow' => true, 39 | 'roles' => ['?', '@', 'admin'], 40 | ], 41 | ], 42 | ], 43 | ]; 44 | } 45 | ... 46 | } 47 | ``` 48 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/docs/data-model.md: -------------------------------------------------------------------------------- 1 | # Data Model 2 | 3 | When Yii2-user is installed the database is 4 | configured using the Yii2-user data model. 5 | 6 | It can be useful to know what's going on in the 7 | database when Yii2-user is integrated your application. 8 | 9 | ## Entity Relation Diagram 10 | 11 | +----------------+ 1/n 12 | | social_account <----------+ 13 | +----------------+ | 14 | 1 | 15 | +-------+ 1/n 1 +---v----+ 16 | | token <---------------> user | 17 | +-------+ +---^----+ 18 | 1 | 19 | +---------+ 1 | 20 | | profile <-----------------+ 21 | +---------+ 22 | 23 | +------------+ 24 | | migrations | 25 | +------------+ 26 | 27 | ## Explaining some basic tasks 28 | 29 | - Each user has exactely one Profile (./models/User.php ```afterSafe()```) 30 | - A token is generated if a user registers and ```Module::enableConfirmation``` 31 | is set to true (./models/User.php ```register()```). Tokens are not deleted 32 | anymore. 33 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/docs/getting-started.md: -------------------------------------------------------------------------------- 1 | # Getting started with Yii2-user 2 | 3 | Yii2-user is designed to work out of the box. It means that installation requires 4 | minimal steps. Only one configuration step should be taken and you are ready to 5 | have user management on your Yii2 website. 6 | 7 | > If you're using Yii2 advanced template, you should read [this article](usage-with-advanced-template.md) firstly. 8 | 9 | ### 1. Download 10 | 11 | Yii2-user can be installed using composer. Run following command to download and 12 | install Yii2-user: 13 | 14 | ```bash 15 | composer require dektrium/yii2-user 16 | ``` 17 | 18 | ### 2. Configure 19 | 20 | > **NOTE:** Make sure that you don't have `user` component configuration in your config files. 21 | 22 | Add following lines to your main configuration file: 23 | 24 | ```php 25 | 'modules' => [ 26 | 'user' => [ 27 | 'class' => 'dektrium\user\Module', 28 | ], 29 | ], 30 | ``` 31 | 32 | ### 3. Update database schema 33 | 34 | The last thing you need to do is updating your database schema by applying the 35 | migrations. Make sure that you have properly configured `db` application component 36 | and run the following command: 37 | 38 | ```bash 39 | $ php yii migrate/up --migrationPath=@vendor/dektrium/yii2-user/migrations 40 | ``` 41 | 42 | ## Where do I go now? 43 | 44 | You have Yii2-user installed. Now you can check out the [list of articles](README.md) 45 | for more information. 46 | 47 | ## Troubleshooting 48 | 49 | If you're having troubles with Yii2-user, make sure to check out the 50 | [troubleshooting guide](troubleshooting.md). 51 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/docs/mailer.md: -------------------------------------------------------------------------------- 1 | # Mailer 2 | 3 | Yii2-user includes special component named Mailer, which is used to send emails in four different instances: 4 | 5 | - Welcome message contains user's credentials, when `enableGeneratingPassword` is true. 6 | - Registration confirmation message, when `enableConfirmation` is true. 7 | - Email change confirmation message 8 | - Recovery message 9 | 10 | ## Configuration 11 | 12 | Mailer can be configured as followed: 13 | 14 | ```php 15 | ... 16 | 'user' => [ 17 | 'class' => 'dektrium\user\Module', 18 | 'mailer' => [ 19 | 'sender' => 'no-reply@myhost.com', // or ['no-reply@myhost.com' => 'Sender name'] 20 | 'welcomeSubject' => 'Welcome subject', 21 | 'confirmationSubject' => 'Confirmation subject', 22 | 'reconfirmationSubject' => 'Email change subject', 23 | 'recoverySubject' => 'Recovery subject', 24 | ], 25 | ... 26 | ``` -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/docs/troubleshooting.md: -------------------------------------------------------------------------------- 1 | # Troubleshooting 2 | 3 | This page provides a list of common problems and the ways of solving them. 4 | 5 | ### After logging in I'm redirected back without any sign of being logged in 6 | 7 | You probably haven't removed `user` from component section of your application. 8 | 9 | If you need to have custom `user` component, then you should configure it to use 10 | Yii2-user identity class: 11 | 12 | ```php 13 | 'user' => [ 14 | 'class' => 'app\components\User', 15 | 'identityClass' => 'dektrium\user\models\User', 16 | ], 17 | ``` 18 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/docs/using-controller-events.md: -------------------------------------------------------------------------------- 1 | # Using controllers events 2 | 3 | The controllers packaged with the Yii2-user provide a lot of functionality that is sufficient for general use cases. But, 4 | you might find that you need to extend that functionality and add some logic that suits the specific needs of your 5 | application. 6 | 7 | For this purpose, you can either override controller or use events. The controllers are dispatching events in many 8 | places in their code. All events can be found in the constants of needed controller class. 9 | 10 | For example, this event listener will redirect user to login page after successful registration instead of showing 11 | message on a blank page: 12 | 13 | ```php 14 | 'user' => [ 15 | 'class' => \dektrium\user\Module::className(), 16 | 'controllerMap' => [ 17 | 'registration' => [ 18 | 'class' => \dektrium\user\controllers\RegistrationController::className(), 19 | 'on ' . \dektrium\user\controllers\RegistrationController::EVENT_AFTER_REGISTER => function ($e) { 20 | Yii::$app->response->redirect(array('/user/security/login'))->send(); 21 | Yii::$app->end(); 22 | } 23 | ], 24 | ], 25 | ], 26 | ``` 27 | 28 | ### Alternative: Class based-events 29 | 30 | You can also assign events on class-level. 31 | 32 | ```php 33 | \yii\base\Event::on( 34 | \dektrium\user\controllers\RegistrationController::className(), 35 | \dektrium\user\controllers\RegistrationController::EVENT_AFTER_CONFIRM, 36 | function () { 37 | Yii::info('Assigning default roles to user...'); 38 | // implement role assignment(s) 39 | } 40 | ); 41 | ``` 42 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/docs/yii2-rbac.md: -------------------------------------------------------------------------------- 1 | # Powerful RBAC with Yii2-rbac 2 | 3 | Yii2-rbac is another extension for Yii2 which provides CRUD operations for RBAC 4 | and also is highly integrated with Yii2-user and allows to assign roles and 5 | permissions to users. 6 | 7 | ## Installation 8 | 9 | Installation instructions are located in [Yii2-rbac repository](https://github.com/dektrium/yii2-rbac). 10 | 11 | ## Usage 12 | 13 | After installing Yii2-rbac you will be able to manage auth items (roles and 14 | permissions) and assign them to users on update page. 15 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/events/AuthEvent.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\user\events; 13 | 14 | use dektrium\user\models\Account; 15 | use yii\authclient\ClientInterface; 16 | use yii\base\Event; 17 | 18 | /** 19 | * @property Account $account 20 | * @property ClientInterface $client 21 | * @author Dmitry Erofeev 22 | */ 23 | class AuthEvent extends Event 24 | { 25 | /** 26 | * @var ClientInterface 27 | */ 28 | private $_client; 29 | 30 | /** 31 | * @var Account 32 | */ 33 | private $_account; 34 | 35 | /** 36 | * @return Account 37 | */ 38 | public function getAccount() 39 | { 40 | return $this->_account; 41 | } 42 | 43 | /** 44 | * @param Account $account 45 | */ 46 | public function setAccount(Account $account) 47 | { 48 | $this->_account = $account; 49 | } 50 | 51 | /** 52 | * @return ClientInterface 53 | */ 54 | public function getClient() 55 | { 56 | return $this->_client; 57 | } 58 | 59 | /** 60 | * @param ClientInterface $client 61 | */ 62 | public function setClient(ClientInterface $client) 63 | { 64 | $this->_client = $client; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/events/ConnectEvent.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\user\events; 13 | 14 | use dektrium\user\models\User; 15 | use dektrium\user\models\Account; 16 | use yii\base\Event; 17 | 18 | /** 19 | * @property User $model 20 | * @property Account $account 21 | * @author Dmitry Erofeev 22 | */ 23 | class ConnectEvent extends Event 24 | { 25 | /** 26 | * @var User 27 | */ 28 | private $_user; 29 | 30 | /** 31 | * @var Account 32 | */ 33 | private $_account; 34 | 35 | /** 36 | * @return Account 37 | */ 38 | public function getAccount() 39 | { 40 | return $this->_account; 41 | } 42 | 43 | /** 44 | * @param Account $account 45 | */ 46 | public function setAccount(Account $account) 47 | { 48 | $this->_account = $account; 49 | } 50 | 51 | /** 52 | * @return User 53 | */ 54 | public function getUser() 55 | { 56 | return $this->_user; 57 | } 58 | 59 | /** 60 | * @param User $form 61 | */ 62 | public function setUser(User $user) 63 | { 64 | $this->_user = $user; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/events/FormEvent.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\user\events; 13 | 14 | use yii\base\Event; 15 | use yii\base\Model; 16 | 17 | /** 18 | * @property Model $model 19 | * @author Dmitry Erofeev 20 | */ 21 | class FormEvent extends Event 22 | { 23 | /** 24 | * @var Model 25 | */ 26 | private $_form; 27 | 28 | /** 29 | * @return Model 30 | */ 31 | public function getForm() 32 | { 33 | return $this->_form; 34 | } 35 | 36 | /** 37 | * @param Model $form 38 | */ 39 | public function setForm(Model $form) 40 | { 41 | $this->_form = $form; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/events/ProfileEvent.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\user\events; 13 | 14 | use dektrium\user\models\Profile; 15 | use yii\base\Event; 16 | 17 | /** 18 | * @property Profile $model 19 | * @author Dmitry Erofeev 20 | */ 21 | class ProfileEvent extends Event 22 | { 23 | /** 24 | * @var Profile 25 | */ 26 | private $_profile; 27 | 28 | /** 29 | * @return Profile 30 | */ 31 | public function getProfile() 32 | { 33 | return $this->_profile; 34 | } 35 | 36 | /** 37 | * @param Profile $form 38 | */ 39 | public function setProfile(Profile $form) 40 | { 41 | $this->_profile = $form; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/events/ResetPasswordEvent.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\user\events; 13 | 14 | use dektrium\user\models\RecoveryForm; 15 | use dektrium\user\models\Token; 16 | use yii\base\Event; 17 | 18 | /** 19 | * @property Token $token 20 | * @property RecoveryForm $form 21 | * @author Dmitry Erofeev 22 | */ 23 | class ResetPasswordEvent extends Event 24 | { 25 | /** 26 | * @var RecoveryForm 27 | */ 28 | private $_form; 29 | 30 | /** 31 | * @var Token 32 | */ 33 | private $_token; 34 | 35 | /** 36 | * @return Token 37 | */ 38 | public function getToken() 39 | { 40 | return $this->_token; 41 | } 42 | 43 | /** 44 | * @param Token $token 45 | */ 46 | public function setToken(Token $token = null) 47 | { 48 | $this->_token = $token; 49 | } 50 | 51 | /** 52 | * @return RecoveryForm 53 | */ 54 | public function getForm() 55 | { 56 | return $this->_form; 57 | } 58 | 59 | /** 60 | * @param RecoveryForm $form 61 | */ 62 | public function setForm(RecoveryForm $form = null) 63 | { 64 | $this->_form = $form; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/events/UserEvent.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\user\events; 13 | 14 | use dektrium\user\models\User; 15 | use yii\base\Event; 16 | 17 | /** 18 | * @property User $model 19 | * @author Dmitry Erofeev 20 | */ 21 | class UserEvent extends Event 22 | { 23 | /** 24 | * @var User 25 | */ 26 | private $_user; 27 | 28 | /** 29 | * @return User 30 | */ 31 | public function getUser() 32 | { 33 | return $this->_user; 34 | } 35 | 36 | /** 37 | * @param User $form 38 | */ 39 | public function setUser(User $form) 40 | { 41 | $this->_user = $form; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/filters/AccessRule.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\user\filters; 13 | 14 | /** 15 | * Access rule class for simpler RBAC. 16 | * @see http://yii2-user.dmeroff.ru/docs/custom-access-control 17 | * @author Dmitry Erofeev 18 | */ 19 | class AccessRule extends \yii\filters\AccessRule 20 | { 21 | /** 22 | * @inheritdoc 23 | * */ 24 | protected function matchRole($user) 25 | { 26 | if (empty($this->roles)) { 27 | return true; 28 | } 29 | 30 | foreach ($this->roles as $role) { 31 | if ($role === '?') { 32 | if (\Yii::$app->user->isGuest) { 33 | return true; 34 | } 35 | } elseif ($role === '@') { 36 | if (!\Yii::$app->user->isGuest) { 37 | return true; 38 | } 39 | } elseif ($role === 'admin') { 40 | if (!\Yii::$app->user->isGuest && \Yii::$app->user->identity->isAdmin) { 41 | return true; 42 | } 43 | } elseif ($user->can($role)) { 44 | return true; 45 | } 46 | } 47 | 48 | return false; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/filters/BackendFilter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\user\filters; 13 | 14 | use yii\web\NotFoundHttpException; 15 | use yii\base\ActionFilter; 16 | 17 | /** 18 | * BackendFilter is used to allow access only to admin and security controller in frontend when using Yii2-user with 19 | * Yii2 advanced template. 20 | * 21 | * @author Dmitry Erofeev 22 | */ 23 | class BackendFilter extends ActionFilter 24 | { 25 | /** 26 | * @var array 27 | */ 28 | public $controllers = ['profile', 'recovery', 'registration', 'settings']; 29 | 30 | /** 31 | * @param \yii\base\Action $action 32 | * 33 | * @return bool 34 | * @throws \yii\web\NotFoundHttpException 35 | */ 36 | public function beforeAction($action) 37 | { 38 | if (in_array($action->controller->id, $this->controllers)) { 39 | throw new NotFoundHttpException('Not found'); 40 | } 41 | 42 | return true; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/filters/FrontendFilter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\user\filters; 13 | 14 | use yii\base\ActionFilter; 15 | use yii\web\NotFoundHttpException; 16 | 17 | /** 18 | * FrontendFilter is used to restrict access to admin controller in frontend when using Yii2-user with Yii2 19 | * advanced template. 20 | * 21 | * @author Dmitry Erofeev 22 | */ 23 | class FrontendFilter extends ActionFilter 24 | { 25 | /** 26 | * @var array 27 | */ 28 | public $controllers = ['admin']; 29 | 30 | /** 31 | * @param \yii\base\Action $action 32 | * 33 | * @return bool 34 | * @throws \yii\web\NotFoundHttpException 35 | */ 36 | public function beforeAction($action) 37 | { 38 | if (in_array($action->controller->id, $this->controllers)) { 39 | throw new NotFoundHttpException('Not found'); 40 | } 41 | 42 | return true; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/helpers/Timezone.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\user\helpers; 13 | 14 | /** 15 | * Timezone helper. 16 | * 17 | * @author Dmitry Erofeev 18 | */ 19 | class Timezone 20 | { 21 | 22 | /** 23 | * Get all of the time zones with the offsets sorted by their offset 24 | * 25 | * @return array 26 | */ 27 | public static function getAll() 28 | { 29 | $timeZones = []; 30 | $timeZoneIdentifiers = \DateTimeZone::listIdentifiers(); 31 | 32 | foreach ($timeZoneIdentifiers as $timeZone) { 33 | $date = new \DateTime('now', new \DateTimeZone($timeZone)); 34 | $offset = $date->getOffset() / 60 / 60; 35 | $timeZones[] = [ 36 | 'timezone' => $timeZone, 37 | 'name' => "{$timeZone} (UTC " . ($offset > 0 ? '+' : '') . "{$offset})", 38 | 'offset' => $offset 39 | ]; 40 | } 41 | 42 | \yii\helpers\ArrayHelper::multisort($timeZones, 'offset', SORT_DESC, SORT_NUMERIC); 43 | 44 | return $timeZones; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/messages/message.php: -------------------------------------------------------------------------------- 1 | __DIR__ . '/../', 5 | 'messagePath' => __DIR__, 6 | 'languages' => [ 7 | 'ca', 8 | 'da', 9 | 'de', 10 | 'de-DU', 11 | 'es', 12 | 'fa-IR', 13 | 'fi', 14 | 'fr', 15 | 'hr', 16 | 'hu', 17 | 'it', 18 | 'kz', 19 | 'lt', 20 | 'nl', 21 | 'pl', 22 | 'pt-BR', 23 | 'pt-PT', 24 | 'ro', 25 | 'ru', 26 | 'th', 27 | 'tr_TR', 28 | 'uk', 29 | 'vi', 30 | 'zh-CN', 31 | ], 32 | 'translator' => 'Yii::t', 33 | 'sort' => false, 34 | 'overwrite' => true, 35 | 'removeUnused' => false, 36 | 'only' => ['*.php'], 37 | 'except' => [ 38 | '.svn', 39 | '.git', 40 | '.gitignore', 41 | '.gitkeep', 42 | '.hgignore', 43 | '.hgkeep', 44 | '/messages', 45 | '/tests', 46 | '/vendor', 47 | ], 48 | 'format' => 'php', 49 | ]; 50 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/migrations/m140403_174025_create_account_table.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use dektrium\user\migrations\Migration; 13 | 14 | /** 15 | * @author Dmitry Erofeev createTable('{{%account}}', [ 22 | 'id' => $this->primaryKey(), 23 | 'user_id' => $this->integer()->null(), 24 | 'provider' => $this->string()->notNull(), 25 | 'client_id' => $this->string()->notNull(), 26 | 'properties' => $this->text()->null(), 27 | ], $this->tableOptions); 28 | 29 | $this->createIndex('{{%account_unique}}', '{{%account}}', ['provider', 'client_id'], true); 30 | $this->addForeignKey('{{%fk_user_account}}', '{{%account}}', 'user_id', '{{%user}}', 'id', $this->cascade, $this->restrict); 31 | } 32 | 33 | public function down() 34 | { 35 | $this->dropTable('{{%account}}'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/migrations/m140504_130429_create_token_table.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use dektrium\user\migrations\Migration; 13 | 14 | /** 15 | * @author Dmitry Erofeev 16 | */ 17 | class m140504_130429_create_token_table extends Migration 18 | { 19 | public function up() 20 | { 21 | $this->createTable('{{%token}}', [ 22 | 'user_id' => $this->integer()->notNull(), 23 | 'code' => $this->string(32)->notNull(), 24 | 'created_at' => $this->integer()->notNull(), 25 | 'type' => $this->smallInteger()->notNull(), 26 | ], $this->tableOptions); 27 | 28 | $this->createIndex('{{%token_unique}}', '{{%token}}', ['user_id', 'code', 'type'], true); 29 | $this->addForeignKey('{{%fk_user_token}}', '{{%token}}', 'user_id', '{{%user}}', 'id', $this->cascade, $this->restrict); 30 | } 31 | 32 | public function down() 33 | { 34 | $this->dropTable('{{%token}}'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/migrations/m140830_171933_fix_ip_field.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use dektrium\user\migrations\Migration; 13 | 14 | /** 15 | * @author Dmitry Erofeev 16 | */ 17 | class m140830_171933_fix_ip_field extends Migration 18 | { 19 | public function up() 20 | { 21 | $this->alterColumn('{{%user}}', 'registration_ip', $this->bigInteger()); 22 | } 23 | 24 | public function down() 25 | { 26 | $this->alterColumn('{{%user}}', 'registration_ip', $this->integer()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/migrations/m140830_172703_change_account_table_name.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use dektrium\user\migrations\Migration; 13 | 14 | /** 15 | * @author Dmitry Erofeev 16 | */ 17 | class m140830_172703_change_account_table_name extends Migration 18 | { 19 | public function up() 20 | { 21 | $this->renameTable('{{%account}}', '{{%social_account}}'); 22 | } 23 | 24 | public function down() 25 | { 26 | $this->renameTable('{{%social_account}}', '{{%account}}'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/migrations/m141222_135246_alter_username_length.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use dektrium\user\migrations\Migration; 13 | 14 | class m141222_135246_alter_username_length extends Migration 15 | { 16 | public function up() 17 | { 18 | if ($this->dbType == 'sqlsrv') { 19 | $this->dropIndex('{{%user_unique_username}}', '{{%user}}'); 20 | } 21 | if ($this->dbType == 'pgsql') { 22 | $this->alterColumn('{{%user}}', 'username', 'SET NOT NULL'); 23 | } else { 24 | $this->alterColumn('{{%user}}', 'username', $this->string(255)->notNull()); 25 | } 26 | if ($this->dbType == 'sqlsrv') { 27 | $this->createIndex('{{%user_unique_username}}', '{{%user}}', 'username', true); 28 | } 29 | } 30 | 31 | public function down() 32 | { 33 | if ($this->dbType == 'sqlsrv') { 34 | $this->dropIndex('{{%user_unique_username}}', '{{%user}}'); 35 | } 36 | if ($this->dbType == 'pgsql') { 37 | $this->alterColumn('{{%user}}', 'username', 'DROP NOT NULL'); 38 | } else { 39 | $this->alterColumn('{{%user}}', 'username', $this->string(255)->notNull()); 40 | } 41 | if ($this->dbType == 'sqlsrv') { 42 | $this->createIndex('{{%user_unique_username}}', '{{%user}}', 'username', true); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/migrations/m150623_212711_fix_username_notnull.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use dektrium\user\migrations\Migration; 13 | 14 | class m150623_212711_fix_username_notnull extends Migration 15 | { 16 | public function up() 17 | { 18 | if ($this->dbType == 'pgsql') { 19 | $this->alterColumn('{{%user}}', 'username', 'SET NOT NULL'); 20 | } else { 21 | if ($this->dbType == 'sqlsrv') { 22 | $this->dropIndex('{{%user_unique_username}}', '{{%user}}'); 23 | } 24 | $this->alterColumn('{{%user}}', 'username', $this->string(255)->notNull()); 25 | if ($this->dbType == 'sqlsrv') { 26 | $this->createIndex('{{%user_unique_username}}', '{{%user}}', 'username', true); 27 | } 28 | } 29 | } 30 | 31 | public function down() 32 | { 33 | if ($this->dbType == "pgsql") { 34 | $this->alterColumn('{{%user}}', 'username', 'DROP NOT NULL'); 35 | } else { 36 | if ($this->dbType == 'sqlsrv') { 37 | $this->dropIndex('{{%user_unique_username}}', '{{%user}}'); 38 | } 39 | $this->alterColumn('{{%user}}', 'username', $this->string(255)->null()); 40 | if ($this->dbType == 'sqlsrv') { 41 | $this->createIndex('{{%user_unique_username}}', '{{%user}}', 'username', true); 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/migrations/m151218_234654_add_timezone_to_profile.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use dektrium\user\migrations\Migration; 13 | 14 | class m151218_234654_add_timezone_to_profile extends Migration 15 | { 16 | public function up() 17 | { 18 | $this->addColumn('{{%profile}}', 'timezone', $this->string(40)->null()); 19 | } 20 | 21 | public function down() 22 | { 23 | $this->dropcolumn('{{%profile}}', 'timezone'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/migrations/m160929_103127_add_last_login_at_to_user_table.php: -------------------------------------------------------------------------------- 1 | addColumn('{{%user}}', 'last_login_at', $this->integer()); 10 | 11 | } 12 | 13 | public function down() 14 | { 15 | $this->dropColumn('{{%user}}', 'last_login_at'); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/_app/config/console.php: -------------------------------------------------------------------------------- 1 | 'yii2-test-console', 5 | 'basePath' => dirname(__DIR__), 6 | 'aliases' => [ 7 | '@dektrium/user' => dirname(dirname(dirname(__DIR__))), 8 | '@tests' => dirname(dirname(__DIR__)), 9 | ], 10 | 'components' => [ 11 | 'log' => null, 12 | 'cache' => null, 13 | 'db' => require __DIR__ . '/db.php', 14 | ], 15 | ]; 16 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/_app/config/db.php: -------------------------------------------------------------------------------- 1 | 'yii\db\Connection', 5 | 'dsn' => 'mysql:host=localhost;dbname=dektrium_test', 6 | 'username' => 'root', 7 | 'password' => '', 8 | 'charset' => 'utf8', 9 | ]; 10 | 11 | if (file_exists(__DIR__ . '/db.local.php')) { 12 | $db = array_merge($db, require(__DIR__ . '/db.local.php')); 13 | } 14 | 15 | return $db; -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/_app/config/test.php: -------------------------------------------------------------------------------- 1 | 'yii2-user-tests', 5 | 'basePath' => dirname(__DIR__), 6 | 'language' => 'en-US', 7 | 'aliases' => [ 8 | '@dektrium/user' => dirname(dirname(dirname(__DIR__))), 9 | '@tests' => dirname(dirname(__DIR__)), 10 | '@vendor' => VENDOR_DIR, 11 | '@bower' => VENDOR_DIR . '/bower-asset', 12 | ], 13 | 'bootstrap' => ['dektrium\user\Bootstrap'], 14 | 'modules' => [ 15 | 'user' => [ 16 | 'class' => 'dektrium\user\Module', 17 | 'admins' => ['user'], 18 | ], 19 | ], 20 | 'components' => [ 21 | 'db' => require __DIR__ . '/db.php', 22 | 'mailer' => [ 23 | 'useFileTransport' => true, 24 | ], 25 | 'urlManager' => [ 26 | 'showScriptName' => true, 27 | ], 28 | 'request' => [ 29 | 'cookieValidationKey' => 'test', 30 | 'enableCsrfValidation' => false, 31 | ], 32 | ], 33 | 'params' => [], 34 | ]; -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/_app/controllers/SiteController.php: -------------------------------------------------------------------------------- 1 | render('index'); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/_app/views/layouts/main.php: -------------------------------------------------------------------------------- 1 | user->getIsGuest()) { 4 | echo \yii\helpers\Html::a('Login', ['/user/security/login']); 5 | echo \yii\helpers\Html::a('Registration', ['/user/registration/register']); 6 | } else { 7 | echo \yii\helpers\Html::a('Logout', ['/user/security/logout']); 8 | } 9 | 10 | echo $content; 11 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/_app/views/site/index.php: -------------------------------------------------------------------------------- 1 | Index 2 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/_app/yii.php: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | run(); 12 | exit($exitCode); -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/_bootstrap.php: -------------------------------------------------------------------------------- 1 | [ 7 | 'user_id' => 1, 8 | 'name' => 'John Doe', 9 | ], 10 | ]; 11 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/_fixtures/data/token.php: -------------------------------------------------------------------------------- 1 | [ 9 | 'user_id' => 2, 10 | 'code' => 'NO2aCmBIjFQX624xmAc3VBu7Th3NJoa6', 11 | 'type' => Token::TYPE_CONFIRMATION, 12 | 'created_at' => $time, 13 | ], 14 | 'expired_confirmation' => [ 15 | 'user_id' => 3, 16 | 'code' => 'qxYa315rqRgCOjYGk82GFHMEAV3T82AX', 17 | 'type' => Token::TYPE_CONFIRMATION, 18 | 'created_at' => $time - 86401, 19 | ], 20 | 'expired_recovery' => [ 21 | 'user_id' => 5, 22 | 'code' => 'a5839d0e73b9c525942c2f59e88c1aaf', 23 | 'type' => Token::TYPE_RECOVERY, 24 | 'created_at' => $time - 21601, 25 | ], 26 | 'recovery' => [ 27 | 'user_id' => 6, 28 | 'code' => '6f5d0dad53ef73e6ba6f01a441c0e602', 29 | 'type' => Token::TYPE_RECOVERY, 30 | 'created_at' => $time, 31 | ], 32 | ]; 33 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/_output/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/_pages/AdminPage.php: -------------------------------------------------------------------------------- 1 | actor->fillField('#user-username', $username); 25 | $this->actor->fillField('#user-email', $email); 26 | $this->actor->fillField('#user-password', $password); 27 | $this->actor->click('Save'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/_pages/LoginPage.php: -------------------------------------------------------------------------------- 1 | actor->fillField('#login-form-login', $login); 24 | $this->actor->fillField('#login-form-password', $password); 25 | $this->actor->click('Sign in'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/_pages/RecoveryPage.php: -------------------------------------------------------------------------------- 1 | actor->fillField('#recovery-form-email', $email); 23 | $this->actor->click('Continue'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/_pages/RegistrationPage.php: -------------------------------------------------------------------------------- 1 | actor->fillField('#register-form-email', $email); 25 | $this->actor->fillField('#register-form-username', $username); 26 | if ($password !== null) { 27 | $this->actor->fillField('#register-form-password', $password); 28 | } 29 | $this->actor->click('Sign up'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/_pages/ResendPage.php: -------------------------------------------------------------------------------- 1 | actor->fillField('#resend-form-email', $email); 23 | $this->actor->click('Continue'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/_pages/SettingsPage.php: -------------------------------------------------------------------------------- 1 | actor->fillField('#settings-form-email', $email); 26 | $this->actor->fillField('#settings-form-username', $username); 27 | $this->actor->fillField('#settings-form-new_password', $password); 28 | $this->actor->fillField('#settings-form-current_password', $currentPassword); 29 | $this->actor->click('Save'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/_pages/UpdatePage.php: -------------------------------------------------------------------------------- 1 | actor->fillField('#user-username', $username); 25 | $this->actor->fillField('#user-email', $email); 26 | $this->actor->fillField('#user-password', $password); 27 | $this->actor->click('Update'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/_support/FunctionalTester.php: -------------------------------------------------------------------------------- 1 | wantTo('ensure that confirmation works'); 12 | $I->haveFixtures(['token' => TokenFixture::className()]); 13 | 14 | $I->amGoingTo('check that error is showed when token expired'); 15 | $token = $I->grabFixture('token', 'expired_confirmation'); 16 | $I->amOnPage(Url::toRoute(['/user/registration/confirm', 'id' => $token->user_id, 'code' => $token->code])); 17 | $I->see('The confirmation link is invalid or expired. Please try requesting a new one.'); 18 | 19 | $I->amGoingTo('check that user get confirmed'); 20 | $token = $I->grabFixture('token', 'confirmation'); 21 | $I->amOnPage(Url::toRoute(['/user/registration/confirm', 'id' => $token->user_id, 'code' => $token->code])); 22 | $I->see('Thank you, registration is now complete.'); 23 | $I->see('Logout'); 24 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/functional/CreateCept.php: -------------------------------------------------------------------------------- 1 | wantTo('ensure that user creation works'); 13 | $I->haveFixtures(['user' => UserFixture::className()]); 14 | 15 | $loginPage = LoginPage::openBy($I); 16 | $user = $I->grabFixture('user', 'user'); 17 | $loginPage->login($user->email, 'qwerty'); 18 | 19 | $page = CreatePage::openBy($I); 20 | 21 | $I->amGoingTo('try to create user with empty fields'); 22 | $page->create('', '', ''); 23 | $I->expectTo('see validations errors'); 24 | $I->see('Username cannot be blank.'); 25 | $I->see('Email cannot be blank.'); 26 | 27 | $page->create('foobar', 'foobar@example.com', 'foobar'); 28 | $I->see('User has been created'); 29 | 30 | Yii::$app->user->logout(); 31 | LoginPage::openBy($I)->login('foobar@example.com', 'foobar'); 32 | $I->see('Logout'); 33 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/functional/LoginCept.php: -------------------------------------------------------------------------------- 1 | wantTo('ensure that login works'); 12 | $I->haveFixtures(['user' => UserFixture::className()]); 13 | 14 | $page = LoginPage::openBy($I); 15 | 16 | $I->amGoingTo('try to login with empty credentials'); 17 | $page->login('', ''); 18 | $I->expectTo('see validations errors'); 19 | $I->see('Login cannot be blank.'); 20 | $I->see('Password cannot be blank.'); 21 | 22 | $I->amGoingTo('try to login with unconfirmed account'); 23 | $user = $I->grabFixture('user', 'unconfirmed'); 24 | $page->login($user->email, 'qwerty'); 25 | $I->see('You need to confirm your email address'); 26 | 27 | $I->amGoingTo('try to login with blocked account'); 28 | $user = $I->grabFixture('user', 'blocked'); 29 | $page->login($user->email, 'qwerty'); 30 | $I->see('Your account has been blocked'); 31 | 32 | $I->amGoingTo('try to login with wrong credentials'); 33 | $user = $I->grabFixture('user', 'user'); 34 | $page->login($user->email, 'wrong'); 35 | $I->expectTo('see validations errors'); 36 | $I->see('Invalid login or password'); 37 | 38 | $I->amGoingTo('try to login with correct credentials'); 39 | $page->login($user->email, 'qwerty'); 40 | $I->dontSee('Login'); 41 | $I->see('Logout'); 42 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/functional/ResendCept.php: -------------------------------------------------------------------------------- 1 | wantTo('ensure that resending of confirmation tokens works'); 12 | $I->haveFixtures(['user' => UserFixture::className()]); 13 | 14 | $I->amGoingTo('try to resend token to non-existent user'); 15 | $page = ResendPage::openBy($I); 16 | $page->resend('foo@example.com'); 17 | $I->see('A message has been sent to your email address. It contains a confirmation link that you must click to complete registration.'); 18 | 19 | $I->amGoingTo('try to resend token to already confirmed user'); 20 | $page = ResendPage::openBy($I); 21 | $user = $I->grabFixture('user', 'user'); 22 | $page->resend($user->email); 23 | $I->see('A message has been sent to your email address. It contains a confirmation link that you must click to complete registration.'); 24 | 25 | $I->amGoingTo('try to resend token to unconfirmed user'); 26 | $page = ResendPage::openBy($I); 27 | $user = $I->grabFixture('user', 'unconfirmed'); 28 | $page->resend($user->email); 29 | $I->see('A message has been sent to your email address. It contains a confirmation link that you must click to complete registration.'); 30 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/functional/UpdateCept.php: -------------------------------------------------------------------------------- 1 | wantTo('ensure that user update works'); 13 | $I->haveFixtures(['user' => UserFixture::className()]); 14 | 15 | $loginPage = LoginPage::openBy($I); 16 | $user = $I->grabFixture('user', 'user'); 17 | $loginPage->login($user->email, 'qwerty'); 18 | 19 | $page = UpdatePage::openBy($I, ['id' => $user->id]); 20 | 21 | $page->update('user', 'updated_user@example.com', 'new_pass'); 22 | $I->see('Account details have been updated'); 23 | 24 | Yii::$app->user->logout(); 25 | LoginPage::openBy($I)->login('updated_user@example.com', 'new_pass'); 26 | $I->see('Logout'); 27 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/tests/functional/_bootstrap.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\user\traits; 13 | 14 | use yii\base\Model; 15 | use yii\web\Response; 16 | use yii\widgets\ActiveForm; 17 | 18 | /** 19 | * @author Dmitry Erofeev 20 | */ 21 | trait AjaxValidationTrait 22 | { 23 | /** 24 | * Performs ajax validation. 25 | * 26 | * @param Model $model 27 | * 28 | * @throws \yii\base\ExitException 29 | */ 30 | protected function performAjaxValidation(Model $model) 31 | { 32 | if (\Yii::$app->request->isAjax && $model->load(\Yii::$app->request->post())) { 33 | \Yii::$app->response->format = Response::FORMAT_JSON; 34 | \Yii::$app->response->data = ActiveForm::validate($model); 35 | \Yii::$app->response->send(); 36 | \Yii::$app->end(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/traits/ModuleTrait.php: -------------------------------------------------------------------------------- 1 | getModule('user'); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/views/_alert.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use yii\bootstrap\Alert; 13 | 14 | /** 15 | * @var dektrium\user\Module $module 16 | */ 17 | ?> 18 | 19 | enableFlashMessages): ?> 20 |
21 |
22 | session->getAllFlashes() as $type => $message): ?> 23 | 24 | ['class' => 'alert-dismissible alert-' . $type], 26 | 'body' => $message 27 | ]) ?> 28 | 29 | 30 |
31 |
32 | 33 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/views/admin/_account.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use yii\bootstrap\ActiveForm; 13 | use yii\helpers\Html; 14 | 15 | /** 16 | * @var yii\web\View $this 17 | * @var dektrium\user\models\User $user 18 | */ 19 | ?> 20 | 21 | beginContent('@dektrium/user/views/admin/update.php', ['user' => $user]) ?> 22 | 23 | 'horizontal', 25 | 'enableAjaxValidation' => true, 26 | 'enableClientValidation' => false, 27 | 'fieldConfig' => [ 28 | 'horizontalCssClasses' => [ 29 | 'wrapper' => 'col-sm-9', 30 | ], 31 | ], 32 | ]); ?> 33 | 34 | render('_user', ['form' => $form, 'user' => $user]) ?> 35 | 36 |
37 |
38 | 'btn btn-block btn-success']) ?> 39 |
40 |
41 | 42 | 43 | 44 | endContent() ?> 45 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/views/admin/_assignments.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use dektrium\rbac\widgets\Assignments; 13 | 14 | /** 15 | * @var yii\web\View $this 16 | * @var dektrium\user\models\User $user 17 | */ 18 | ?> 19 | 20 | beginContent('@dektrium/user/views/admin/update.php', ['user' => $user]) ?> 21 | 22 | [ 24 | 'class' => 'alert-info alert-dismissible', 25 | ], 26 | 'body' => Yii::t('user', 'You can assign multiple roles or permissions to user by using the form below'), 27 | ]) ?> 28 | 29 | $user->id]) ?> 30 | 31 | endContent() ?> 32 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/views/admin/_profile.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use yii\bootstrap\ActiveForm; 13 | use yii\helpers\Html; 14 | 15 | /** 16 | * @var yii\web\View $this 17 | * @var dektrium\user\models\User $user 18 | * @var dektrium\user\models\Profile $profile 19 | */ 20 | ?> 21 | 22 | beginContent('@dektrium/user/views/admin/update.php', ['user' => $user]) ?> 23 | 24 | 'horizontal', 26 | 'enableAjaxValidation' => true, 27 | 'enableClientValidation' => false, 28 | 'fieldConfig' => [ 29 | 'horizontalCssClasses' => [ 30 | 'wrapper' => 'col-sm-9', 31 | ], 32 | ], 33 | ]); ?> 34 | 35 | field($profile, 'name') ?> 36 | field($profile, 'public_email') ?> 37 | field($profile, 'website') ?> 38 | field($profile, 'location') ?> 39 | field($profile, 'gravatar_email') ?> 40 | field($profile, 'bio')->textarea() ?> 41 | 42 |
43 |
44 | 'btn btn-block btn-success']) ?> 45 |
46 |
47 | 48 | 49 | 50 | endContent() ?> 51 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/views/admin/_user.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | /** 13 | * @var yii\widgets\ActiveForm $form 14 | * @var dektrium\user\models\User $user 15 | */ 16 | ?> 17 | 18 | field($user, 'email')->textInput(['maxlength' => 255]) ?> 19 | field($user, 'username')->textInput(['maxlength' => 255]) ?> 20 | field($user, 'password')->passwordInput() ?> 21 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/views/mail/layouts/text.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | /** 13 | * @var string $content main view render result 14 | */ 15 | ?> 16 | 17 | beginPage() ?> 18 | beginBody() ?> 19 | 20 | endBody() ?> 21 | endPage() ?> 22 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/views/mail/new_password.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use yii\helpers\Html; 13 | 14 | /** 15 | * @var dektrium\user\Module $module 16 | * @var dektrium\user\models\User $user 17 | * @var dektrium\user\models\Password $password 18 | */ 19 | 20 | ?> 21 |

22 | , 23 |

24 | 25 |

26 | name) ?>. 27 | : password ?> 28 |

29 | 30 |

31 | . 32 |

33 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/views/mail/text/confirmation.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | /** 13 | * @var dektrium\user\models\User $user 14 | * @var dektrium\user\models\Token $token 15 | */ 16 | ?> 17 | , 18 | 19 | name) ?>. 20 | . 21 | 22 | url ?> 23 | 24 | . 25 | 26 | . 27 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/views/mail/text/new_password.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | /** 13 | * @var dektrium\user\models\User 14 | */ 15 | ?> 16 | , 17 | 18 | name) ?>. 19 | : 20 | password ?> 21 | 22 | . 23 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/views/mail/text/reconfirmation.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | /** 13 | * @var dektrium\user\models\Token $token 14 | */ 15 | ?> 16 | , 17 | 18 | name 22 | ) ?>. 23 | . 24 | 25 | url ?> 26 | 27 | . 28 | 29 | . 30 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/views/mail/text/recovery.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | /** 13 | * @var dektrium\user\models\User $user 14 | * @var dektrium\user\models\Token $token 15 | */ 16 | ?> 17 | , 18 | 19 | name) ?>. 20 | . 21 | 22 | url ?> 23 | 24 | . 25 | 26 | . 27 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/views/mail/text/welcome.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | /** 13 | * @var dektrium\user\models\User 14 | */ 15 | ?> 16 | , 17 | 18 | name) ?>. 19 | enableGeneratingPassword): ?> 20 | : 21 | password ?> 22 | 23 | 24 | 25 | . 26 | 27 | url ?> 28 | 29 | . 30 | 31 | 32 | . 33 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/views/message.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | /** 13 | * @var yii\web\View $this 14 | * @var dektrium\user\Module $module 15 | */ 16 | 17 | $this->title = $title; 18 | ?> 19 | 20 | render('/_alert', ['module' => $module]); 21 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/views/recovery/request.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use yii\helpers\Html; 13 | use yii\widgets\ActiveForm; 14 | 15 | /** 16 | * @var yii\web\View $this 17 | * @var yii\widgets\ActiveForm $form 18 | * @var dektrium\user\models\RecoveryForm $model 19 | */ 20 | 21 | $this->title = Yii::t('user', 'Recover your password'); 22 | $this->params['breadcrumbs'][] = $this->title; 23 | ?> 24 |
25 |
26 |
27 |
28 |

title) ?>

29 |
30 |
31 | 'password-recovery-form', 33 | 'enableAjaxValidation' => true, 34 | 'enableClientValidation' => false, 35 | ]); ?> 36 | 37 | field($model, 'email')->textInput(['autofocus' => true]) ?> 38 | 39 | 'btn btn-primary btn-block']) ?>
40 | 41 | 42 |
43 |
44 |
45 |
46 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/views/recovery/reset.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use yii\helpers\Html; 13 | use yii\widgets\ActiveForm; 14 | 15 | /** 16 | * @var yii\web\View $this 17 | * @var yii\widgets\ActiveForm $form 18 | * @var dektrium\user\models\RecoveryForm $model 19 | */ 20 | 21 | $this->title = Yii::t('user', 'Reset your password'); 22 | $this->params['breadcrumbs'][] = $this->title; 23 | ?> 24 |
25 |
26 |
27 |
28 |

title) ?>

29 |
30 |
31 | 'password-recovery-form', 33 | 'enableAjaxValidation' => true, 34 | 'enableClientValidation' => false, 35 | ]); ?> 36 | 37 | field($model, 'password')->passwordInput() ?> 38 | 39 | 'btn btn-success btn-block']) ?>
40 | 41 | 42 |
43 |
44 |
45 |
46 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/views/registration/resend.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use yii\helpers\Html; 13 | use yii\widgets\ActiveForm; 14 | 15 | /** 16 | * @var yii\web\View $this 17 | * @var dektrium\user\models\ResendForm $model 18 | */ 19 | 20 | $this->title = Yii::t('user', 'Request new confirmation message'); 21 | $this->params['breadcrumbs'][] = $this->title; 22 | ?> 23 |
24 |
25 |
26 |
27 |

title) ?>

28 |
29 |
30 | 'resend-form', 32 | 'enableAjaxValidation' => true, 33 | 'enableClientValidation' => false, 34 | ]); ?> 35 | 36 | field($model, 'email')->textInput(['autofocus' => true]) ?> 37 | 38 | 'btn btn-primary btn-block']) ?>
39 | 40 | 41 |
42 |
43 |
44 |
45 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/views/settings/_menu.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use yii\helpers\Html; 13 | use yii\widgets\Menu; 14 | 15 | /** 16 | * @var dektrium\user\models\User $user 17 | */ 18 | 19 | $user = Yii::$app->user->identity; 20 | $networksVisible = count(Yii::$app->authClientCollection->clients) > 0; 21 | ?> 22 |
23 |
24 |

25 | profile->getAvatarUrl(24), [ 26 | 'class' => 'img-rounded', 27 | 'alt' => $user->username, 28 | ]) ?> 29 | username ?> 30 |

31 |
32 |
33 | [ 35 | 'class' => 'nav nav-pills nav-stacked', 36 | ], 37 | 'items' => [ 38 | ['label' => Yii::t('user', 'Profile'), 'url' => ['/user/settings/profile']], 39 | ['label' => Yii::t('user', 'Account'), 'url' => ['/user/settings/account']], 40 | [ 41 | 'label' => Yii::t('user', 'Networks'), 42 | 'url' => ['/user/settings/networks'], 43 | 'visible' => $networksVisible 44 | ], 45 | ], 46 | ]) ?> 47 |
48 |
49 | -------------------------------------------------------------------------------- /common/modules/dektrium/yii2-user/widgets/Login.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE.md 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace dektrium\user\widgets; 13 | 14 | use dektrium\user\models\LoginForm; 15 | use yii\base\Widget; 16 | 17 | /** 18 | * Login for widget. 19 | * 20 | * @author Dmitry Erofeev 21 | */ 22 | class Login extends Widget 23 | { 24 | /** 25 | * @var bool 26 | */ 27 | public $validate = true; 28 | 29 | /** 30 | * @inheritdoc 31 | */ 32 | public function run() 33 | { 34 | return $this->render('login', [ 35 | 'model' => \Yii::createObject(LoginForm::className()), 36 | ]); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /common/tests/_bootstrap.php: -------------------------------------------------------------------------------- 1 | 'bayer.hudson', 6 | 'auth_key' => 'HP187Mvq7Mmm3CTU80dLkGmni_FUH_lR', 7 | //password_0 8 | 'password_hash' => '$2y$13$EjaPFBnZOQsHdGuHI.xvhuDp1fHpo8hKRSk6yshqa9c5EG8s3C3lO', 9 | 'password_reset_token' => 'ExzkCOaYc1L8IOBs4wdTGGbgNiG3Wz1I_1402312317', 10 | 'created_at' => '1402312317', 11 | 'updated_at' => '1402312317', 12 | 'email' => 'nicole.paucek@schultz.info', 13 | ], 14 | ]; 15 | -------------------------------------------------------------------------------- /common/tests/_output/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /common/tests/_support/.gitignore: -------------------------------------------------------------------------------- 1 | _generated 2 | -------------------------------------------------------------------------------- /common/tests/_support/UnitTester.php: -------------------------------------------------------------------------------- 1 | ['gii'], 4 | 'modules' => [ 5 | 'gii' => 'yii\gii\Module', 6 | ], 7 | 'components' => [ 8 | 'db' => [ 9 | 'class' => 'yii\db\Connection', 10 | 'dsn' => 'mysql:host=localhost;dbname=partner1', 11 | 'username' => 'root', 12 | 'password' => 'root', 13 | 'charset' => 'utf8', 14 | ], 15 | ] 16 | ]; 17 | -------------------------------------------------------------------------------- /console/config/main.php: -------------------------------------------------------------------------------- 1 | 'app-console', 11 | 'basePath' => dirname(__DIR__), 12 | 'bootstrap' => ['log'], 13 | 'controllerNamespace' => 'console\controllers', 14 | 'modules' => [ 15 | 'user' => [ 16 | 'class' => 'dektrium\user\Module', 17 | ], 18 | 'rbac' => 'dektrium\rbac\RbacConsoleModule', 19 | ], 20 | 'components' => [ 21 | // 'authManager' => [ 22 | // 'class' => 'yii\rbac\DbManager', 23 | // 'itemTable' => '{{%rbac_auth_item}}', 24 | // 'itemChildTable' => '{{%rbac_auth_item_child}}', 25 | // 'assignmentTable' => '{{%rbac_auth_assignment}}', 26 | // 'ruleTable' => '{{%rbac_auth_rule}}' 27 | // ], 28 | 'log' => [ 29 | 'targets' => [ 30 | [ 31 | 'class' => 'yii\log\FileTarget', 32 | 'levels' => ['error', 'warning'], 33 | ], 34 | ], 35 | ], 36 | ], 37 | 'params' => $params, 38 | ]; 39 | -------------------------------------------------------------------------------- /console/config/params-local_dist.php: -------------------------------------------------------------------------------- 1 | 'admin@example.com', 4 | ]; 5 | -------------------------------------------------------------------------------- /console/controllers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dvizh/shop-skeleton/15fec9b64567cedd4eb9b04271ee41f36440ed5e/console/controllers/.gitkeep -------------------------------------------------------------------------------- /console/migrations/m170317_090004_news.php: -------------------------------------------------------------------------------- 1 | db = 'db'; 12 | parent::init(); 13 | } 14 | 15 | public function safeUp() 16 | { 17 | $tableOptions = 'ENGINE=InnoDB'; 18 | 19 | $this->createTable( 20 | '{{%news}}', 21 | [ 22 | 'id'=> $this->primaryKey(11), 23 | 'title'=> $this->string(255)->notNull(), 24 | 'anons'=> $this->string(300)->notNull(), 25 | 'text'=> $this->text()->notNull(), 26 | 'slug'=> $this->string(255)->notNull(), 27 | 'date'=> $this->datetime()->notNull(), 28 | 'status'=> $this->string()->notNull()->defaultValue('draft'), 29 | ],$tableOptions 30 | ); 31 | } 32 | 33 | public function safeDown() 34 | { 35 | $this->dropTable('{{%news}}'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /console/migrations/m170317_090025_slider.php: -------------------------------------------------------------------------------- 1 | db = 'db'; 12 | parent::init(); 13 | } 14 | 15 | public function safeUp() 16 | { 17 | $tableOptions = 'ENGINE=InnoDB'; 18 | 19 | $this->createTable( 20 | '{{%slider}}', 21 | [ 22 | 'id'=> $this->primaryKey(11), 23 | 'url'=> $this->string(255)->null()->defaultValue(null), 24 | 'short_text'=> $this->string(255)->null()->defaultValue(null), 25 | 'sort'=> $this->integer(11)->null()->defaultValue(null), 26 | ],$tableOptions 27 | ); 28 | $this->createIndex('id','{{%slider}}','id',false); 29 | } 30 | 31 | public function safeDown() 32 | { 33 | $this->dropIndex('id', '{{%slider}}'); 34 | $this->dropTable('{{%slider}}'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /console/migrations/m170317_090234_page.php: -------------------------------------------------------------------------------- 1 | db = 'db'; 12 | parent::init(); 13 | } 14 | 15 | public function safeUp() 16 | { 17 | $tableOptions = 'ENGINE=InnoDB'; 18 | 19 | $this->createTable( 20 | '{{%page}}', 21 | [ 22 | 'id'=> $this->primaryKey(11), 23 | 'show_page'=> $this->string()->notNull()->defaultValue('No'), 24 | 'slug'=> $this->string(255)->notNull(), 25 | 'title'=> $this->string(255)->notNull(), 26 | 'text'=> $this->text()->notNull(), 27 | ],$tableOptions 28 | ); 29 | } 30 | 31 | public function safeDown() 32 | { 33 | $this->dropTable('{{%page}}'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /console/models/.gitkeep: -------------------------------------------------------------------------------- 1 | * 2 | -------------------------------------------------------------------------------- /console/runtime/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /environments/dev/backend/config/main-local.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'request' => [ 6 | // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 7 | 'cookieValidationKey' => '', 8 | ], 9 | ], 10 | ]; 11 | 12 | if (!YII_ENV_TEST) { 13 | // configuration adjustments for 'dev' environment 14 | $config['bootstrap'][] = 'debug'; 15 | $config['modules']['debug'] = [ 16 | 'class' => 'yii\debug\Module', 17 | ]; 18 | 19 | $config['bootstrap'][] = 'gii'; 20 | $config['modules']['gii'] = [ 21 | 'class' => 'yii\gii\Module', 22 | ]; 23 | } 24 | 25 | return $config; 26 | -------------------------------------------------------------------------------- /environments/dev/backend/config/params-local.php: -------------------------------------------------------------------------------- 1 | run(); 19 | -------------------------------------------------------------------------------- /environments/dev/backend/web/index.php: -------------------------------------------------------------------------------- 1 | run(); 18 | -------------------------------------------------------------------------------- /environments/dev/common/config/main-local.php: -------------------------------------------------------------------------------- 1 | [ 4 | 'db' => [ 5 | 'class' => 'yii\db\Connection', 6 | 'dsn' => 'mysql:host=localhost;dbname=yii2advanced', 7 | 'username' => 'root', 8 | 'password' => '', 9 | 'charset' => 'utf8', 10 | ], 11 | 'mailer' => [ 12 | 'class' => 'yii\swiftmailer\Mailer', 13 | 'viewPath' => '@common/mail', 14 | // send all mails to a file by default. You have to set 15 | // 'useFileTransport' to false and configure a transport 16 | // for the mailer to send real emails. 17 | 'useFileTransport' => true, 18 | ], 19 | ], 20 | ]; 21 | -------------------------------------------------------------------------------- /environments/dev/common/config/params-local.php: -------------------------------------------------------------------------------- 1 | [ 8 | 'db' => [ 9 | 'dsn' => 'mysql:host=localhost;dbname=yii2advanced_test', 10 | ] 11 | ], 12 | ] 13 | ); 14 | -------------------------------------------------------------------------------- /environments/dev/console/config/main-local.php: -------------------------------------------------------------------------------- 1 | ['gii'], 4 | 'modules' => [ 5 | 'gii' => 'yii\gii\Module', 6 | ], 7 | ]; 8 | -------------------------------------------------------------------------------- /environments/dev/console/config/params-local.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'request' => [ 6 | // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 7 | 'cookieValidationKey' => '', 8 | ], 9 | ], 10 | ]; 11 | 12 | if (!YII_ENV_TEST) { 13 | // configuration adjustments for 'dev' environment 14 | $config['bootstrap'][] = 'debug'; 15 | $config['modules']['debug'] = [ 16 | 'class' => 'yii\debug\Module', 17 | ]; 18 | 19 | $config['bootstrap'][] = 'gii'; 20 | $config['modules']['gii'] = [ 21 | 'class' => 'yii\gii\Module', 22 | ]; 23 | } 24 | 25 | return $config; 26 | -------------------------------------------------------------------------------- /environments/dev/frontend/config/params-local.php: -------------------------------------------------------------------------------- 1 | run(); 19 | -------------------------------------------------------------------------------- /environments/dev/frontend/web/index.php: -------------------------------------------------------------------------------- 1 | run(); 18 | -------------------------------------------------------------------------------- /environments/dev/yii: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | run(); 28 | exit($exitCode); 29 | -------------------------------------------------------------------------------- /environments/dev/yii_test: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | run(); 27 | exit($exitCode); 28 | -------------------------------------------------------------------------------- /environments/dev/yii_test.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem ------------------------------------------------------------- 4 | rem Yii command line bootstrap script for Windows. 5 | rem 6 | rem @author Qiang Xue 7 | rem @link http://www.yiiframework.com/ 8 | rem @copyright Copyright (c) 2008 Yii Software LLC 9 | rem @license http://www.yiiframework.com/license/ 10 | rem ------------------------------------------------------------- 11 | 12 | @setlocal 13 | 14 | set YII_PATH=%~dp0 15 | 16 | if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe 17 | 18 | "%PHP_COMMAND%" "%YII_PATH%yii_test" %* 19 | 20 | @endlocal 21 | -------------------------------------------------------------------------------- /environments/prod/backend/config/main-local.php: -------------------------------------------------------------------------------- 1 | [ 4 | 'request' => [ 5 | // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 6 | 'cookieValidationKey' => '', 7 | ], 8 | ], 9 | ]; 10 | -------------------------------------------------------------------------------- /environments/prod/backend/config/params-local.php: -------------------------------------------------------------------------------- 1 | run(); 18 | -------------------------------------------------------------------------------- /environments/prod/common/config/main-local.php: -------------------------------------------------------------------------------- 1 | [ 4 | 'db' => [ 5 | 'class' => 'yii\db\Connection', 6 | 'dsn' => 'mysql:host=localhost;dbname=yii2advanced', 7 | 'username' => 'root', 8 | 'password' => '', 9 | 'charset' => 'utf8', 10 | ], 11 | 'mailer' => [ 12 | 'class' => 'yii\swiftmailer\Mailer', 13 | 'viewPath' => '@common/mail', 14 | ], 15 | ], 16 | ]; 17 | -------------------------------------------------------------------------------- /environments/prod/common/config/params-local.php: -------------------------------------------------------------------------------- 1 | [ 4 | 'request' => [ 5 | // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 6 | 'cookieValidationKey' => '', 7 | ], 8 | ], 9 | ]; 10 | -------------------------------------------------------------------------------- /environments/prod/frontend/config/params-local.php: -------------------------------------------------------------------------------- 1 | run(); 18 | -------------------------------------------------------------------------------- /environments/prod/yii: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | run(); 28 | exit($exitCode); 29 | -------------------------------------------------------------------------------- /frontend/assets/AppAsset.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'request' => [ 6 | // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 7 | 'cookieValidationKey' => 'cvcGLbg0jK9Cq34Fa4xtaUMYxRUmfkgC', 8 | ], 9 | ], 10 | ]; 11 | 12 | if (!YII_ENV_TEST) { 13 | // configuration adjustments for 'dev' environment 14 | $config['bootstrap'][] = 'debug'; 15 | $config['modules']['debug'] = [ 16 | 'class' => 'yii\debug\Module', 17 | ]; 18 | 19 | $config['bootstrap'][] = 'gii'; 20 | $config['modules']['gii'] = [ 21 | 'class' => 'yii\gii\Module', 22 | ]; 23 | } 24 | 25 | return $config; 26 | -------------------------------------------------------------------------------- /frontend/config/main.php: -------------------------------------------------------------------------------- 1 | 'app-frontend', 11 | 'basePath' => dirname(__DIR__), 12 | 'bootstrap' => ['log'], 13 | 'controllerNamespace' => 'frontend\controllers', 14 | 'modules' => [ 15 | 'user' => [ 16 | 'as frontend' => 'dektrium\user\filters\FrontendFilter', 17 | ], 18 | ], 19 | 'components' => [ 20 | 'request' => [ 21 | 'baseUrl' => '', 22 | 'csrfParam' => '_csrf-frontend', 23 | ], 24 | 'user' => [ 25 | 'identityClass' => 'dektrium\user\models\User', 26 | 'identityCookie' => [ 27 | 'name' => '_frontendIdentity', 28 | 'path' => '/', 29 | 'httpOnly' => true, 30 | ], 31 | ], 32 | 'session' => [ 33 | 'name' => 'FRONTENDSESSID', 34 | 'cookieParams' => [ 35 | 'httpOnly' => true, 36 | 'path' => '/', 37 | ], 38 | ], 39 | 'log' => [ 40 | 'traceLevel' => YII_DEBUG ? 3 : 0, 41 | 'targets' => [ 42 | [ 43 | 'class' => 'yii\log\FileTarget', 44 | 'levels' => ['error', 'warning'], 45 | ], 46 | ], 47 | ], 48 | 'errorHandler' => [ 49 | 'errorAction' => 'site/error', 50 | ], 51 | ], 52 | 'params' => $params, 53 | ]; 54 | -------------------------------------------------------------------------------- /frontend/config/params-local_dist.php: -------------------------------------------------------------------------------- 1 | 'admin@example.com', 4 | ]; 5 | -------------------------------------------------------------------------------- /frontend/config/test.php: -------------------------------------------------------------------------------- 1 | 'app-frontend-tests', 4 | ]; 5 | -------------------------------------------------------------------------------- /frontend/models/ContactForm.php: -------------------------------------------------------------------------------- 1 | 'Verification Code', 42 | ]; 43 | } 44 | 45 | /** 46 | * Sends an email to the specified email address using the information collected by this model. 47 | * 48 | * @param string $email the target email address 49 | * @return bool whether the email was sent 50 | */ 51 | public function sendEmail($email) 52 | { 53 | return Yii::$app->mailer->compose() 54 | ->setTo($email) 55 | ->setFrom([$this->email => $this->name]) 56 | ->setSubject($this->subject) 57 | ->setTextBody($this->body) 58 | ->send(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /frontend/runtime/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /frontend/tests/_bootstrap.php: -------------------------------------------------------------------------------- 1 | 'erau', 5 | 'auth_key' => 'tUu1qHcde0diwUol3xeI-18MuHkkprQI', 6 | // password_0 7 | 'password_hash' => '$2y$13$nJ1WDlBaGcbCdbNC5.5l4.sgy.OMEKCqtDQOdQ2OWpgiKRWYyzzne', 8 | 'password_reset_token' => 'RkD_Jw0_8HEedzLk7MM-ZKEFfYR7VbMr_1392559490', 9 | 'created_at' => '1392559490', 10 | 'updated_at' => '1392559490', 11 | 'email' => 'sfriesen@jenkins.info', 12 | ], 13 | ]; 14 | -------------------------------------------------------------------------------- /frontend/tests/_data/user.php: -------------------------------------------------------------------------------- 1 | 'okirlin', 6 | 'auth_key' => 'iwTNae9t34OmnK6l4vT4IeaTk-YWI2Rv', 7 | 'password_hash' => '$2y$13$CXT0Rkle1EMJ/c1l5bylL.EylfmQ39O5JlHJVFpNn618OUS1HwaIi', 8 | 'password_reset_token' => 't5GU9NwpuGYSfb7FEZMAxqtuz2PkEvv_' . time(), 9 | 'created_at' => '1391885313', 10 | 'updated_at' => '1391885313', 11 | 'email' => 'brady.renner@rutherford.com', 12 | ], 13 | [ 14 | 'username' => 'troy.becker', 15 | 'auth_key' => 'EdKfXrx88weFMV0vIxuTMWKgfK2tS3Lp', 16 | 'password_hash' => '$2y$13$g5nv41Px7VBqhS3hVsVN2.MKfgT3jFdkXEsMC4rQJLfaMa7VaJqL2', 17 | 'password_reset_token' => '4BSNyiZNAuxjs5Mty990c47sVrgllIi_' . time(), 18 | 'created_at' => '1391885313', 19 | 'updated_at' => '1391885313', 20 | 'email' => 'nicolas.dianna@hotmail.com', 21 | 'status' => '0', 22 | ], 23 | ]; 24 | -------------------------------------------------------------------------------- /frontend/tests/_output/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /frontend/tests/_support/.gitignore: -------------------------------------------------------------------------------- 1 | _generated 2 | -------------------------------------------------------------------------------- /frontend/tests/_support/FunctionalTester.php: -------------------------------------------------------------------------------- 1 | see($message, '.help-block'); 27 | } 28 | 29 | public function dontSeeValidationError($message) 30 | { 31 | $this->dontSee($message, '.help-block'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /frontend/tests/_support/UnitTester.php: -------------------------------------------------------------------------------- 1 | amOnPage(Url::toRoute('/site/index')); 13 | $I->see('My Company'); 14 | $I->seeLink('About'); 15 | $I->click('About'); 16 | $I->see('This is the About page.'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /frontend/tests/acceptance/_bootstrap.php: -------------------------------------------------------------------------------- 1 | amOnRoute('site/about'); 11 | $I->see('About', 'h1'); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /frontend/tests/functional/HomeCest.php: -------------------------------------------------------------------------------- 1 | amOnPage(\Yii::$app->homeUrl); 12 | $I->see('My Company'); 13 | $I->seeLink('About'); 14 | $I->click('About'); 15 | $I->see('This is the About page.'); 16 | } 17 | } -------------------------------------------------------------------------------- /frontend/tests/functional/LoginCest.php: -------------------------------------------------------------------------------- 1 | haveFixtures([ 13 | 'user' => [ 14 | 'class' => UserFixture::className(), 15 | 'dataFile' => codecept_data_dir() . 'login_data.php' 16 | ] 17 | ]); 18 | $I->amOnRoute('site/login'); 19 | } 20 | 21 | protected function formParams($login, $password) 22 | { 23 | return [ 24 | 'LoginForm[username]' => $login, 25 | 'LoginForm[password]' => $password, 26 | ]; 27 | } 28 | 29 | public function checkEmpty(FunctionalTester $I) 30 | { 31 | $I->submitForm('#login-form', $this->formParams('', '')); 32 | $I->seeValidationError('Username cannot be blank.'); 33 | $I->seeValidationError('Password cannot be blank.'); 34 | } 35 | 36 | public function checkWrongPassword(FunctionalTester $I) 37 | { 38 | $I->submitForm('#login-form', $this->formParams('admin', 'wrong')); 39 | $I->seeValidationError('Incorrect username or password.'); 40 | } 41 | 42 | public function checkValidLogin(FunctionalTester $I) 43 | { 44 | $I->submitForm('#login-form', $this->formParams('erau', 'password_0')); 45 | $I->see('Logout (erau)', 'form button[type=submit]'); 46 | $I->dontSeeLink('Login'); 47 | $I->dontSeeLink('Signup'); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /frontend/tests/functional/_bootstrap.php: -------------------------------------------------------------------------------- 1 | attributes = [ 14 | 'name' => 'Tester', 15 | 'email' => 'tester@example.com', 16 | 'subject' => 'very important letter subject', 17 | 'body' => 'body of current message', 18 | ]; 19 | 20 | expect_that($model->sendEmail('admin@example.com')); 21 | 22 | // using Yii2 module actions to check email was sent 23 | $this->tester->seeEmailIsSent(); 24 | 25 | $emailMessage = $this->tester->grabLastSentEmail(); 26 | expect('valid email is sent', $emailMessage)->isInstanceOf('yii\mail\MessageInterface'); 27 | expect($emailMessage->getTo())->hasKey('admin@example.com'); 28 | expect($emailMessage->getFrom())->hasKey('tester@example.com'); 29 | expect($emailMessage->getSubject())->equals('very important letter subject'); 30 | expect($emailMessage->toString())->contains('body of current message'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /frontend/tests/unit/models/ResetPasswordFormTest.php: -------------------------------------------------------------------------------- 1 | tester->haveFixtures([ 19 | 'user' => [ 20 | 'class' => UserFixture::className(), 21 | 'dataFile' => codecept_data_dir() . 'user.php' 22 | ], 23 | ]); 24 | } 25 | 26 | public function testResetWrongToken() 27 | { 28 | $this->tester->expectException('yii\base\InvalidParamException', function() { 29 | new ResetPasswordForm(''); 30 | }); 31 | 32 | $this->tester->expectException('yii\base\InvalidParamException', function() { 33 | new ResetPasswordForm('notexistingtoken_1391882543'); 34 | }); 35 | } 36 | 37 | public function testResetCorrectToken() 38 | { 39 | $user = $this->tester->grabFixture('user', 0); 40 | $form = new ResetPasswordForm($user['password_reset_token']); 41 | expect_that($form->resetPassword()); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /frontend/views/site/about.php: -------------------------------------------------------------------------------- 1 | title = 'About'; 8 | $this->params['breadcrumbs'][] = $this->title; 9 | ?> 10 |
11 |

title) ?>

12 | 13 |

This is the About page. You may modify the following file to customize its content:

14 | 15 | 16 |
17 | -------------------------------------------------------------------------------- /frontend/views/site/contact.php: -------------------------------------------------------------------------------- 1 | title = 'Contact'; 12 | $this->params['breadcrumbs'][] = $this->title; 13 | ?> 14 |
15 |

title) ?>

16 | 17 |

18 | If you have business inquiries or other questions, please fill out the following form to contact us. Thank you. 19 |

20 | 21 |
22 |
23 | 'contact-form']); ?> 24 | 25 | field($model, 'name')->textInput(['autofocus' => true]) ?> 26 | 27 | field($model, 'email') ?> 28 | 29 | field($model, 'subject') ?> 30 | 31 | field($model, 'body')->textarea(['rows' => 6]) ?> 32 | 33 | field($model, 'verifyCode')->widget(Captcha::className(), [ 34 | 'template' => '
{image}
{input}
', 35 | ]) ?> 36 | 37 |
38 | 'btn btn-primary', 'name' => 'contact-button']) ?> 39 |
40 | 41 | 42 |
43 |
44 | 45 |
46 | -------------------------------------------------------------------------------- /frontend/views/site/error.php: -------------------------------------------------------------------------------- 1 | title = $name; 11 | ?> 12 |
13 | 14 |

title) ?>

15 | 16 |
17 | 18 |
19 | 20 |

21 | The above error occurred while the Web server was processing your request. 22 |

23 |

24 | Please contact us if you think this is a server error. Thank you. 25 |

26 | 27 |
28 | -------------------------------------------------------------------------------- /frontend/views/site/thanks.php: -------------------------------------------------------------------------------- 1 |
2 |

Ну вот и хорошо

3 | 4 |

Теперь заказ у нас.

5 |
-------------------------------------------------------------------------------- /frontend/web/.gitignore: -------------------------------------------------------------------------------- 1 | /index.php 2 | /index-test.php 3 | -------------------------------------------------------------------------------- /frontend/web/.htaccess: -------------------------------------------------------------------------------- 1 | RewriteEngine On 2 | 3 | RewriteCond %{REQUEST_FILENAME} !-f 4 | RewriteCond %{REQUEST_FILENAME} !-d 5 | 6 | RewriteRule . index.php -------------------------------------------------------------------------------- /frontend/web/assets/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /frontend/web/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dvizh/shop-skeleton/15fec9b64567cedd4eb9b04271ee41f36440ed5e/frontend/web/favicon.ico -------------------------------------------------------------------------------- /frontend/web/images/placeHolder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dvizh/shop-skeleton/15fec9b64567cedd4eb9b04271ee41f36440ed5e/frontend/web/images/placeHolder.png -------------------------------------------------------------------------------- /frontend/web/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: -------------------------------------------------------------------------------- /init.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem ------------------------------------------------------------- 4 | rem Yii command line init script for Windows. 5 | rem 6 | rem @author Qiang Xue 7 | rem @link http://www.yiiframework.com/ 8 | rem @copyright Copyright (c) 2008 Yii Software LLC 9 | rem @license http://www.yiiframework.com/license/ 10 | rem ------------------------------------------------------------- 11 | 12 | @setlocal 13 | 14 | set YII_PATH=%~dp0 15 | 16 | if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe 17 | 18 | "%PHP_COMMAND%" "%YII_PATH%init" %* 19 | 20 | @endlocal 21 | -------------------------------------------------------------------------------- /migrate.sh: -------------------------------------------------------------------------------- 1 | php yii migrate/up --migrationPath=vendor/yiisoft/yii2/rbac/migrations --interactive=0 2 | php yii migrate/up --migrationPath=common/modules/dektrium/yii2-user/migrations --interactive=0 3 | php yii migrate/up --migrationPath=migrations --interactive=0 4 | php yii migrate/up --migrationPath=vendor/dvizh/yii2-shop/src/migrations --interactive=0 5 | php yii migrate/up --migrationPath=vendor/dvizh/yii2-order/src/migrations --interactive=0 6 | php yii migrate/up --migrationPath=vendor/dvizh/yii2-cart/src/migrations --interactive=0 7 | php yii migrate/up --migrationPath=vendor/dvizh/yii2-filter/src/migrations --interactive=0 8 | php yii migrate/up --migrationPath=vendor/dvizh/yii2-field/src/migrations --interactive=0 9 | php yii migrate/up --migrationPath=vendor/dvizh/yii2-seo/src/migrations --interactive=0 10 | php yii migrate/up --migrationPath=vendor/dvizh/yii2-gallery/src/migrations --interactive=0 11 | php yii migrate/up --migrationPath=vendor/dvizh/yii2-promocode/src/migrations --interactive=0 12 | php yii migrate/up --migrationPath=vendor/dvizh/yii2-certificate/src/migrations --interactive=0 13 | php yii migrate/up --migrationPath=@vendor/pheme/yii2-settings/migrations 14 | -------------------------------------------------------------------------------- /migrations/m170418_170456_register_user.php: -------------------------------------------------------------------------------- 1 | insert('{{%user}}', [ 7 | 'id' => 1, 8 | 'username' => 'administrator', 9 | 'email' => 'administrator@localhost.lc', 10 | 'password_hash' => '$2y$10$C5nrtr7JOXXz0CZ/5aymjOu3Vx3iTOm9HcqpPs3D7ZiCXoVOFKAn.', 11 | 'auth_key' => 'qI8YZpXSQF1dujgB0GH9361xDfcB8Qwl', 12 | 'confirmed_at' => '1492070371', 13 | 'unconfirmed_email' => null, 14 | 'blocked_at' => null, 15 | 'registration_ip' => '127.0.0.1', 16 | 'created_at' => 1492070371, 17 | 'updated_at' => 1492070371, 18 | 'flags' => 0, 19 | 'last_login_at' => null 20 | ]); 21 | 22 | $this->insert('{{%profile}}', [ 23 | 'user_id' => 1, 24 | 'name' => null, 25 | 'public_email' => null, 26 | 'gravatar_email' => null, 27 | 'gravatar_id' => null, 28 | 'location' => null, 29 | 'website' => null, 30 | 'bio' => null, 31 | 'timezone' => null 32 | ]); 33 | } 34 | 35 | public function down() 36 | { 37 | 38 | } 39 | } -------------------------------------------------------------------------------- /migrations/m170426_174712_insert_user_role.php: -------------------------------------------------------------------------------- 1 | insert('{{%rbac_auth_item}}', [ 7 | 'name' => 'superadmin', 8 | 'type' => '1', 9 | 'description' => '', 10 | 'rule_name' => NULL, 11 | 'data' => 1492519500, 12 | 'created_at' => 1492519500, 13 | 'updated_at' => 1492519500, 14 | ]); 15 | 16 | $this->insert('{{%rbac_auth_assignment}}', [ 17 | 'item_name' => 'superadmin', 18 | 'user_id' => '1', 19 | 'created_at' => 1492519516, 20 | ]); 21 | } 22 | 23 | public function down() 24 | { 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow:/ 3 | -------------------------------------------------------------------------------- /yii: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | run(); 28 | exit($exitCode); 29 | -------------------------------------------------------------------------------- /yii.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem ------------------------------------------------------------- 4 | rem Yii command line bootstrap script for Windows. 5 | rem 6 | rem @author Qiang Xue 7 | rem @link http://www.yiiframework.com/ 8 | rem @copyright Copyright (c) 2008 Yii Software LLC 9 | rem @license http://www.yiiframework.com/license/ 10 | rem ------------------------------------------------------------- 11 | 12 | @setlocal 13 | 14 | set YII_PATH=%~dp0 15 | 16 | if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe 17 | 18 | "%PHP_COMMAND%" "%YII_PATH%yii" %* 19 | 20 | @endlocal 21 | --------------------------------------------------------------------------------