From 6482f79088e3d98667af644a71fb5bdcd6e5d1b0 Mon Sep 17 00:00:00 2001 From: TrixterTheTux Date: Wed, 4 Oct 2017 01:53:28 +0300 Subject: [PATCH 1/5] Grant execute privilege (#655) closes #654 --- app/Repositories/Eloquent/DatabaseRepository.php | 2 +- tests/Unit/Repositories/Eloquent/DatabaseRepositoryTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Repositories/Eloquent/DatabaseRepository.php b/app/Repositories/Eloquent/DatabaseRepository.php index 898b59a55..de3ff65bf 100644 --- a/app/Repositories/Eloquent/DatabaseRepository.php +++ b/app/Repositories/Eloquent/DatabaseRepository.php @@ -93,7 +93,7 @@ class DatabaseRepository extends EloquentRepository implements DatabaseRepositor { return $this->runStatement( sprintf( - 'GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX ON `%s`.* TO `%s`@`%s`', + 'GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX, EXECUTE ON `%s`.* TO `%s`@`%s`', $database, $username, $remote diff --git a/tests/Unit/Repositories/Eloquent/DatabaseRepositoryTest.php b/tests/Unit/Repositories/Eloquent/DatabaseRepositoryTest.php index b601e538c..f33ec15e3 100644 --- a/tests/Unit/Repositories/Eloquent/DatabaseRepositoryTest.php +++ b/tests/Unit/Repositories/Eloquent/DatabaseRepositoryTest.php @@ -117,7 +117,7 @@ class DatabaseRepositoryTest extends TestCase */ public function testUserAssignmentToDatabaseStatement() { - $query = sprintf('GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX ON `%s`.* TO `%s`@`%s`', 'test_database', 'test', '%'); + $query = sprintf('GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX, EXECUTE ON `%s`.* TO `%s`@`%s`', 'test_database', 'test', '%'); $this->repository->shouldReceive('runStatement')->with($query, 'test')->once()->andReturn(true); $this->assertTrue($this->repository->assignUserToDatabase('test_database', 'test', '%', 'test')); From d7518d2a979644f5131ef80bbed84bf020b01b35 Mon Sep 17 00:00:00 2001 From: kasper Franz Date: Thu, 5 Oct 2017 00:05:14 +0200 Subject: [PATCH 2/5] updated vagrant provision to be using the new namespace (#659) * updated to use the new commands --- .dev/vagrant/provision.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.dev/vagrant/provision.sh b/.dev/vagrant/provision.sh index f5a35a0f2..41b3fa920 100644 --- a/.dev/vagrant/provision.sh +++ b/.dev/vagrant/provision.sh @@ -65,8 +65,8 @@ composer install --no-progress php artisan key:generate --force php artisan migrate php artisan db:seed -php artisan pterodactyl:user --firstname Test --lastname Admin --username admin --email testadmin@pterodactyl.io --password Ptero123 --admin 1 -php artisan pterodactyl:user --firstname Test --lastname User --username user --email testuser@pterodactyl.io --password Ptero123 --admin 0 +php artisan p:user:make --name-first Test --name-last Admin --username admin --email testadmin@pterodactyl.io --password Ptero123 --admin 1 +php artisan p:user:make --name-first Test --name-last User --username user --email testuser@pterodactyl.io --password Ptero123 --admin 0 echo "Add queue cronjob and start queue worker" (crontab -l 2>/dev/null; echo "* * * * * php /var/www/html/pterodactyl/artisan schedule:run >> /dev/null 2>&1") | crontab - From 46aeca43d85c2f5a44de21839ef345f27663827e Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Thu, 5 Oct 2017 00:13:10 -0500 Subject: [PATCH 3/5] Update CONTRIBUTING.md --- CONTRIBUTING.md | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 417a5364f..7bdacbebf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,12 +1,33 @@ # Contributing We're glad you want to help us out and make this panel the best that it can be! We have a few simple things to follow when making changes to files and adding new features. +### Project Branches +This section mainly applies to those with read/write access to our repositories, but can be helpful for others. + +The `develop` branch should always be in a runnable state, and not contain any major breaking features. For the most part this means you will need to create `feature/` branches in order to add new functionality, or change how things work. If you are fixing a small bug (`<2 files` and `<20 lines` changed) you can commit right into develop. When making a feature branch, if it is referencing something in the issue tracker, please title the branch `feature/PTDL-###` where `###` is the issue number. + +All new code should contain unit tests at minimum (where applicable). There is a lot of un-covered code currently, so as you are doing things please be looking for places that you can write tests. + +### Update the CHANGELOG +* When adding something that is new, fixed, changed, or security related for the next release you should be adding a note to the CHANGELOG. If something is changing within the same version (i.e. fixing a bug introduced but not released) it should _not_ go into the CHANGELOG. + ### Code Guidelines -*This section is still under construction.* +We are a `PSR-4` and `PSR-0` compliant project, so please follow those guidelines at a minimum. In addition, StyleCI runs on all of our code to ensure the formatting is standardized across everything. When a PR is made StyleCI will analyze your code and make a pull to that branch if necessary to fix any formatting issues. This project also ships with a PHP-CS configuration file and you are welcome to configure your local environment to make use of that. -We are a `PSR-4` and `PSR-0` compliant project, so please follow those guidelines at a minimum. In addition, StyleCI runs on all of our code to ensure the formatting is standardized across everything. Please follow the existing code formatting, I will write up more detailed documentation at a later time. +All class variable declarations should be in alphabetical order, and constructor arguments should be in alphabetical order based on the classname. See the example below for how this should look, or check out any of the `app/Service` files for examples. -In addition, all functions must be properly Doc-Block'd. +```php +class ProcessScheduleService +{ + protected $repository; + protected $runnerService; + + public function __construct(RunTaskService $runnerService, ScheduleRepositoryInterface $repository) + { + $this->repository = $repository; + $this->runnerService = $runnerService; + } +``` ### Responsible Disclosure This is a fairly in-depth project, and makes use of a lot of parts. We strive to keep everything as secure as possible, and welcome you to take a look into it yourself. We do ask that you be considerate of others who are using the software and not publicly disclose security issues without contacting us first by email. @@ -18,4 +39,4 @@ If you've found what you believe is a security issue please email us at `support ### Where to find Us You can find us in a couple places online. First and foremost, we're active right here on Github. If you encounter a bug or other problem open an issue on here for us to take a look at it. We also accept feature requests here as well. -You can also find us on [Discord](https://pterodactyl.io/discord) or our [community forums](https://forums.pterodactyl.io/). In the event that you need to get in contact with us privately feel free to contact us at `support@pterodactyl.io`. Try not to email us with requests for support regarding the panel, we'll probably just direct you to our forums or here. +You can also find us on [Discord](https://pterodactyl.io/discord) or our [community forums](https://forums.pterodactyl.io/). In the event that you need to get in contact with us privately feel free to contact us at `support@pterodactyl.io`. Try not to email us with requests for support regarding the panel, we'll probably just direct you to our forums or Discord. From 953f14b4e1c403893d8edf78a8f85da6ae80b7d3 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Thu, 5 Oct 2017 00:14:36 -0500 Subject: [PATCH 4/5] Update CONTRIBUTING.md --- CONTRIBUTING.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7bdacbebf..ed14ccb25 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,9 @@ We're glad you want to help us out and make this panel the best that it can be! ### Project Branches This section mainly applies to those with read/write access to our repositories, but can be helpful for others. -The `develop` branch should always be in a runnable state, and not contain any major breaking features. For the most part this means you will need to create `feature/` branches in order to add new functionality, or change how things work. If you are fixing a small bug (`<2 files` and `<20 lines` changed) you can commit right into develop. When making a feature branch, if it is referencing something in the issue tracker, please title the branch `feature/PTDL-###` where `###` is the issue number. +The `develop` branch should always be in a runnable state, and not contain any major breaking features. For the most part this means you will need to create `feature/` branches in order to add new functionality, or change how things work. When making a feature branch, if it is referencing something in the issue tracker, please title the branch `feature/PTDL-###` where `###` is the issue number. + +Moving forward all commits from contributors should be in the form of a PR, unless it is something we have previous discussed as being able to be pushed right into `develop`. All new code should contain unit tests at minimum (where applicable). There is a lot of un-covered code currently, so as you are doing things please be looking for places that you can write tests. From b450e43f3b79dbc59d6f2d658f520b7ded0f23ab Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Thu, 5 Oct 2017 00:14:42 -0500 Subject: [PATCH 5/5] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ed14ccb25..2f41a33b2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,7 +11,7 @@ Moving forward all commits from contributors should be in the form of a PR, unle All new code should contain unit tests at minimum (where applicable). There is a lot of un-covered code currently, so as you are doing things please be looking for places that you can write tests. ### Update the CHANGELOG -* When adding something that is new, fixed, changed, or security related for the next release you should be adding a note to the CHANGELOG. If something is changing within the same version (i.e. fixing a bug introduced but not released) it should _not_ go into the CHANGELOG. +When adding something that is new, fixed, changed, or security related for the next release you should be adding a note to the CHANGELOG. If something is changing within the same version (i.e. fixing a bug introduced but not released) it should _not_ go into the CHANGELOG. ### Code Guidelines We are a `PSR-4` and `PSR-0` compliant project, so please follow those guidelines at a minimum. In addition, StyleCI runs on all of our code to ensure the formatting is standardized across everything. When a PR is made StyleCI will analyze your code and make a pull to that branch if necessary to fix any formatting issues. This project also ships with a PHP-CS configuration file and you are welcome to configure your local environment to make use of that.