From 6f1638e5fe465d681911018d74547b1e0b8bf1ef Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 8 Feb 2017 15:09:15 -0300 Subject: [PATCH 1/3] Ivan - Update backend methods [skip ci] --- server/controllers/article/add-topic.php | 1 + server/controllers/article/add.php | 1 + server/controllers/article/delete-topic.php | 1 + server/controllers/article/delete.php | 1 + server/controllers/article/edit-topic.php | 1 + server/controllers/article/edit.php | 1 + server/controllers/article/get-all.php | 1 + server/controllers/staff/add.php | 1 + server/controllers/staff/assign-ticket.php | 2 ++ server/controllers/staff/delete.php | 1 + server/controllers/staff/edit.php | 1 + server/controllers/staff/get-all-tickets.php | 1 + server/controllers/staff/get-all.php | 1 + server/controllers/staff/get-new-tickets.php | 1 + server/controllers/staff/get-tickets.php | 1 + server/controllers/staff/get.php | 1 + server/controllers/staff/last-events.php | 1 + server/controllers/staff/search-tickets.php | 1 + server/controllers/staff/un-assign-ticket.php | 1 + server/controllers/system/add-api-key.php | 1 + server/controllers/system/add-department.php | 1 + server/controllers/system/backup-database.php | 1 + server/controllers/system/csv-import.php | 1 + server/controllers/system/delete-all-users.php | 1 + server/controllers/system/delete-api-key.php | 1 + server/controllers/system/delete-department.php | 3 ++- server/controllers/system/disable-registration.php | 1 + server/controllers/system/disable-user-system.php | 1 + server/controllers/system/download.php | 1 + server/controllers/system/edit-department.php | 1 + server/controllers/system/edit-mail-template.php | 1 + server/controllers/system/edit-settings.php | 1 + server/controllers/system/enable-registration.php | 1 + server/controllers/system/enabled-user-system.php | 1 + server/controllers/system/get-all-keys.php | 1 + server/controllers/system/get-logs.php | 1 + server/controllers/system/get-mail-templates.php | 1 + server/controllers/system/get-settings.php | 1 + server/controllers/system/get-stats.php | 1 + server/controllers/system/init-settings.php | 1 + server/controllers/system/recover-mail-template.php | 1 + server/controllers/ticket/add-custom-response.php | 1 + server/controllers/ticket/change-department.php | 1 + server/controllers/ticket/change-priority.php | 1 + server/controllers/ticket/close.php | 1 + server/controllers/ticket/comment.php | 1 + server/controllers/ticket/create.php | 1 + server/controllers/ticket/delete-custom-response.php | 1 + server/controllers/ticket/edit-custom-response.php | 1 + server/controllers/ticket/get-custom-responses.php | 1 + server/controllers/ticket/get.php | 1 + server/controllers/ticket/re-open.php | 1 + server/controllers/ticket/seen.php | 1 + server/controllers/user/ban.php | 1 + server/controllers/user/check-session.php | 1 + server/controllers/user/delete.php | 1 + server/controllers/user/edit-email.php | 1 + server/controllers/user/edit-password.php | 3 ++- server/controllers/user/get-user.php | 3 ++- server/controllers/user/get-users.php | 1 + server/controllers/user/get.php | 1 + server/controllers/user/list-ban.php | 1 + server/controllers/user/login.php | 3 ++- server/controllers/user/logout.php | 1 + server/controllers/user/recover-password.php | 1 + server/controllers/user/send-recover-password.php | 1 + server/controllers/user/signup.php | 3 ++- server/controllers/user/un-ban.php | 1 + server/controllers/user/verify.php | 1 + server/libs/ControllerGroup.php | 6 +++++- 70 files changed, 80 insertions(+), 6 deletions(-) diff --git a/server/controllers/article/add-topic.php b/server/controllers/article/add-topic.php index 9bfe8d99..71e9424b 100644 --- a/server/controllers/article/add-topic.php +++ b/server/controllers/article/add-topic.php @@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true); class AddTopicController extends Controller { const PATH = '/add-topic'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/article/add.php b/server/controllers/article/add.php index 79e6d469..c01d7ecf 100644 --- a/server/controllers/article/add.php +++ b/server/controllers/article/add.php @@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true); class AddArticleController extends Controller { const PATH = '/add'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/article/delete-topic.php b/server/controllers/article/delete-topic.php index 61f372f6..ba10905a 100644 --- a/server/controllers/article/delete-topic.php +++ b/server/controllers/article/delete-topic.php @@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true); class DeleteTopicController extends Controller { const PATH = '/delete-topic'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/article/delete.php b/server/controllers/article/delete.php index a3aafb7c..44886e16 100644 --- a/server/controllers/article/delete.php +++ b/server/controllers/article/delete.php @@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true); class DeleteArticleController extends Controller { const PATH = '/delete'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/article/edit-topic.php b/server/controllers/article/edit-topic.php index c06fef30..5717557b 100644 --- a/server/controllers/article/edit-topic.php +++ b/server/controllers/article/edit-topic.php @@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true); class EditTopicController extends Controller { const PATH = '/edit-topic'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/article/edit.php b/server/controllers/article/edit.php index 86d78a4a..60220680 100644 --- a/server/controllers/article/edit.php +++ b/server/controllers/article/edit.php @@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true); class EditArticleController extends Controller { const PATH = '/edit'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/article/get-all.php b/server/controllers/article/get-all.php index 40a49efc..3f2577be 100644 --- a/server/controllers/article/get-all.php +++ b/server/controllers/article/get-all.php @@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true); class GetAllArticlesController extends Controller { const PATH = '/get-all'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/staff/add.php b/server/controllers/staff/add.php index 7c9a2827..86f6a7cf 100644 --- a/server/controllers/staff/add.php +++ b/server/controllers/staff/add.php @@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true); class AddStaffController extends Controller { const PATH = '/add'; + const METHOD = 'POST'; private $name; private $email; diff --git a/server/controllers/staff/assign-ticket.php b/server/controllers/staff/assign-ticket.php index b92d3364..4f40d524 100644 --- a/server/controllers/staff/assign-ticket.php +++ b/server/controllers/staff/assign-ticket.php @@ -4,6 +4,8 @@ DataValidator::with('CustomValidations', true); class AssignStaffController extends Controller { const PATH = '/assign-ticket'; + const METHOD = 'POST'; + private $ticket; private $user; diff --git a/server/controllers/staff/delete.php b/server/controllers/staff/delete.php index 8aeec886..47cb461a 100644 --- a/server/controllers/staff/delete.php +++ b/server/controllers/staff/delete.php @@ -6,6 +6,7 @@ DataValidator::with('CustomValidations', true); class DeleteStaffController extends Controller { const PATH = '/delete'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/staff/edit.php b/server/controllers/staff/edit.php index fef5f0fc..d62b6fb2 100644 --- a/server/controllers/staff/edit.php +++ b/server/controllers/staff/edit.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class EditStaffController extends Controller { const PATH = '/edit'; + const METHOD = 'POST'; private $staffInstance; diff --git a/server/controllers/staff/get-all-tickets.php b/server/controllers/staff/get-all-tickets.php index be7641a2..98c3f4d6 100644 --- a/server/controllers/staff/get-all-tickets.php +++ b/server/controllers/staff/get-all-tickets.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class GetAllTicketsStaffController extends Controller { const PATH = '/get-all-tickets'; + const METHOD = 'POST'; public function validations() { return[ diff --git a/server/controllers/staff/get-all.php b/server/controllers/staff/get-all.php index 2c93165a..2fc903c6 100644 --- a/server/controllers/staff/get-all.php +++ b/server/controllers/staff/get-all.php @@ -4,6 +4,7 @@ use Respect\Validation\Validator as DataValidator; class GetAllStaffController extends Controller { const PATH ='/get-all'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/staff/get-new-tickets.php b/server/controllers/staff/get-new-tickets.php index de9e2504..61ee2c5f 100644 --- a/server/controllers/staff/get-new-tickets.php +++ b/server/controllers/staff/get-new-tickets.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class GetNewTicketsStaffController extends Controller { const PATH = '/get-new-tickets'; + const METHOD = 'POST'; public function validations() { return[ diff --git a/server/controllers/staff/get-tickets.php b/server/controllers/staff/get-tickets.php index d9ff1289..225dacae 100644 --- a/server/controllers/staff/get-tickets.php +++ b/server/controllers/staff/get-tickets.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class GetTicketStaffController extends Controller { const PATH = '/get-tickets'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/staff/get.php b/server/controllers/staff/get.php index c6dc6418..f5558c9f 100644 --- a/server/controllers/staff/get.php +++ b/server/controllers/staff/get.php @@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true); class GetStaffController extends Controller { const PATH = '/get'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/staff/last-events.php b/server/controllers/staff/last-events.php index c6de992f..aae4b470 100644 --- a/server/controllers/staff/last-events.php +++ b/server/controllers/staff/last-events.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class LastEventsStaffController extends Controller { const PATH = '/last-events'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/staff/search-tickets.php b/server/controllers/staff/search-tickets.php index e7af0189..21998d9a 100644 --- a/server/controllers/staff/search-tickets.php +++ b/server/controllers/staff/search-tickets.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class SearchTicketStaffController extends Controller { const PATH = '/search-tickets'; + const METHOD = 'POST'; public function validations() { return[ diff --git a/server/controllers/staff/un-assign-ticket.php b/server/controllers/staff/un-assign-ticket.php index db15b28e..19630f35 100644 --- a/server/controllers/staff/un-assign-ticket.php +++ b/server/controllers/staff/un-assign-ticket.php @@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true); class UnAssignStaffController extends Controller { const PATH = '/un-assign-ticket'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/system/add-api-key.php b/server/controllers/system/add-api-key.php index 2f32d66d..38a6d1bb 100644 --- a/server/controllers/system/add-api-key.php +++ b/server/controllers/system/add-api-key.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class AddAPIKeyController extends Controller { const PATH = '/add-api-key'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/system/add-department.php b/server/controllers/system/add-department.php index 9f13e7d7..b6de596e 100644 --- a/server/controllers/system/add-department.php +++ b/server/controllers/system/add-department.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class AddDepartmentController extends Controller { const PATH = '/add-department'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/system/backup-database.php b/server/controllers/system/backup-database.php index 82b1fccf..73889e71 100644 --- a/server/controllers/system/backup-database.php +++ b/server/controllers/system/backup-database.php @@ -3,6 +3,7 @@ use Ifsnop\Mysqldump as IMysqldump; class BackupDatabaseController extends Controller { const PATH = '/backup-database'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/system/csv-import.php b/server/controllers/system/csv-import.php index ea3093b8..b7f6a815 100644 --- a/server/controllers/system/csv-import.php +++ b/server/controllers/system/csv-import.php @@ -2,6 +2,7 @@ class CSVImportController extends Controller { const PATH = '/csv-import'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/system/delete-all-users.php b/server/controllers/system/delete-all-users.php index 63749e59..1ac56920 100644 --- a/server/controllers/system/delete-all-users.php +++ b/server/controllers/system/delete-all-users.php @@ -3,6 +3,7 @@ use RedBeanPHP\Facade as RedBean; class DeleteAllUsersController extends Controller { const PATH = '/delete-all-users'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/system/delete-api-key.php b/server/controllers/system/delete-api-key.php index 8ee03152..c38201be 100644 --- a/server/controllers/system/delete-api-key.php +++ b/server/controllers/system/delete-api-key.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class DeleteAPIKeyController extends Controller { const PATH = '/delete-api-key'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/system/delete-department.php b/server/controllers/system/delete-department.php index 0da23a80..452266bc 100644 --- a/server/controllers/system/delete-department.php +++ b/server/controllers/system/delete-department.php @@ -4,7 +4,8 @@ DataValidator::with('CustomValidations', true); class DeleteDepartmentController extends Controller { const PATH = '/delete-department'; - + const METHOD = 'POST'; + private $departmentId; private $transferDepartmentId; diff --git a/server/controllers/system/disable-registration.php b/server/controllers/system/disable-registration.php index 4b9ab053..ab1ae2d7 100644 --- a/server/controllers/system/disable-registration.php +++ b/server/controllers/system/disable-registration.php @@ -2,6 +2,7 @@ class DisableRegistrationController extends Controller { const PATH = '/disable-registration'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/system/disable-user-system.php b/server/controllers/system/disable-user-system.php index fc1cc0a1..acdec689 100644 --- a/server/controllers/system/disable-user-system.php +++ b/server/controllers/system/disable-user-system.php @@ -2,6 +2,7 @@ class DisableUserSystemController extends Controller { const PATH = '/disable-user-system'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/system/download.php b/server/controllers/system/download.php index 278ddc1b..b0b8e639 100644 --- a/server/controllers/system/download.php +++ b/server/controllers/system/download.php @@ -4,6 +4,7 @@ use Respect\Validation\Validator as DataValidator; class DownloadController extends Controller { const PATH = '/download'; + const METHOD = 'GET'; public function validations() { return [ diff --git a/server/controllers/system/edit-department.php b/server/controllers/system/edit-department.php index 30679fbc..2ccf8b7a 100644 --- a/server/controllers/system/edit-department.php +++ b/server/controllers/system/edit-department.php @@ -5,6 +5,7 @@ DataValidator::with('CustomValidations', true); class EditDepartmentController extends Controller { const PATH = '/edit-department'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/system/edit-mail-template.php b/server/controllers/system/edit-mail-template.php index cb916a86..06ddd5e6 100644 --- a/server/controllers/system/edit-mail-template.php +++ b/server/controllers/system/edit-mail-template.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class EditMailTemplateController extends Controller { const PATH = '/edit-mail-template'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/system/edit-settings.php b/server/controllers/system/edit-settings.php index 22454e62..41c86550 100644 --- a/server/controllers/system/edit-settings.php +++ b/server/controllers/system/edit-settings.php @@ -2,6 +2,7 @@ class EditSettingsController extends Controller { const PATH = '/edit-settings'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/system/enable-registration.php b/server/controllers/system/enable-registration.php index 6221daa9..3666eb09 100644 --- a/server/controllers/system/enable-registration.php +++ b/server/controllers/system/enable-registration.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class EnableRegistrationController extends Controller { const PATH = '/enable-registration'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/system/enabled-user-system.php b/server/controllers/system/enabled-user-system.php index 0139608a..375593e0 100644 --- a/server/controllers/system/enabled-user-system.php +++ b/server/controllers/system/enabled-user-system.php @@ -2,6 +2,7 @@ class EnabledUserSystemController extends Controller { const PATH = '/enabled-user-system'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/system/get-all-keys.php b/server/controllers/system/get-all-keys.php index 35206374..fa896451 100644 --- a/server/controllers/system/get-all-keys.php +++ b/server/controllers/system/get-all-keys.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class GetAllKeyController extends Controller { const PATH = '/get-all-keys'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/system/get-logs.php b/server/controllers/system/get-logs.php index 99217560..3caa2447 100644 --- a/server/controllers/system/get-logs.php +++ b/server/controllers/system/get-logs.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class GetLogsController extends Controller { const PATH = '/get-logs'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/system/get-mail-templates.php b/server/controllers/system/get-mail-templates.php index b0d0a46a..cb4de9e0 100644 --- a/server/controllers/system/get-mail-templates.php +++ b/server/controllers/system/get-mail-templates.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class GetMailTemplatesController extends Controller { const PATH = '/get-mail-templates'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/system/get-settings.php b/server/controllers/system/get-settings.php index 41e2299d..15f1df8d 100644 --- a/server/controllers/system/get-settings.php +++ b/server/controllers/system/get-settings.php @@ -2,6 +2,7 @@ class GetSettingsController extends Controller { const PATH = '/get-settings'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/system/get-stats.php b/server/controllers/system/get-stats.php index ff1fdf3a..31a4e67b 100644 --- a/server/controllers/system/get-stats.php +++ b/server/controllers/system/get-stats.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class GetStatsController extends Controller { const PATH = '/get-stats'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/system/init-settings.php b/server/controllers/system/init-settings.php index 4106797b..a3bfdf65 100644 --- a/server/controllers/system/init-settings.php +++ b/server/controllers/system/init-settings.php @@ -2,6 +2,7 @@ class InitSettingsController extends Controller { const PATH = '/init-settings'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/system/recover-mail-template.php b/server/controllers/system/recover-mail-template.php index 9fdff9be..5242ad81 100644 --- a/server/controllers/system/recover-mail-template.php +++ b/server/controllers/system/recover-mail-template.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class RecoverMailTemplateController extends Controller { const PATH = '/recover-mail-template'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/ticket/add-custom-response.php b/server/controllers/ticket/add-custom-response.php index 68af88f7..ac05d2d6 100644 --- a/server/controllers/ticket/add-custom-response.php +++ b/server/controllers/ticket/add-custom-response.php @@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true); class AddCustomResponseController extends Controller { const PATH = '/add-custom-response'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/ticket/change-department.php b/server/controllers/ticket/change-department.php index ac2e78da..61e99a4b 100644 --- a/server/controllers/ticket/change-department.php +++ b/server/controllers/ticket/change-department.php @@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true); class ChangeDepartmentController extends Controller { const PATH = '/change-department'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/ticket/change-priority.php b/server/controllers/ticket/change-priority.php index 2e671a57..18f5be15 100644 --- a/server/controllers/ticket/change-priority.php +++ b/server/controllers/ticket/change-priority.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class ChangePriorityController extends Controller { const PATH = '/change-priority'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/ticket/close.php b/server/controllers/ticket/close.php index ed983a35..a1b6a323 100644 --- a/server/controllers/ticket/close.php +++ b/server/controllers/ticket/close.php @@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true); class CloseController extends Controller { const PATH = '/close'; + const METHOD = 'POST'; private $ticket; diff --git a/server/controllers/ticket/comment.php b/server/controllers/ticket/comment.php index cc0d24ba..c1593472 100644 --- a/server/controllers/ticket/comment.php +++ b/server/controllers/ticket/comment.php @@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true); class CommentController extends Controller { const PATH = '/comment'; + const METHOD = 'POST'; private $ticket; private $content; diff --git a/server/controllers/ticket/create.php b/server/controllers/ticket/create.php index 5b39ab47..23559205 100644 --- a/server/controllers/ticket/create.php +++ b/server/controllers/ticket/create.php @@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true); class CreateController extends Controller { const PATH = '/create'; + const METHOD = 'POST'; private $title; private $content; diff --git a/server/controllers/ticket/delete-custom-response.php b/server/controllers/ticket/delete-custom-response.php index 4ab5ca8b..d9be3c09 100644 --- a/server/controllers/ticket/delete-custom-response.php +++ b/server/controllers/ticket/delete-custom-response.php @@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true); class DeleteCustomResponseController extends Controller { const PATH = '/delete-custom-response'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/ticket/edit-custom-response.php b/server/controllers/ticket/edit-custom-response.php index 12b170a7..c4b5975c 100644 --- a/server/controllers/ticket/edit-custom-response.php +++ b/server/controllers/ticket/edit-custom-response.php @@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true); class EditCustomResponseController extends Controller { const PATH = '/edit-custom-response'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/ticket/get-custom-responses.php b/server/controllers/ticket/get-custom-responses.php index 7c2872cf..e2c0fb64 100644 --- a/server/controllers/ticket/get-custom-responses.php +++ b/server/controllers/ticket/get-custom-responses.php @@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true); class GetCustomResponsesController extends Controller { const PATH = '/get-custom-responses'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/ticket/get.php b/server/controllers/ticket/get.php index 61cba027..c1799e42 100644 --- a/server/controllers/ticket/get.php +++ b/server/controllers/ticket/get.php @@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true); class TicketGetController extends Controller { const PATH = '/get'; + const METHOD = 'POST'; private $ticket; diff --git a/server/controllers/ticket/re-open.php b/server/controllers/ticket/re-open.php index b2754256..0df85fa0 100644 --- a/server/controllers/ticket/re-open.php +++ b/server/controllers/ticket/re-open.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class ReOpenController extends Controller { const PATH = '/re-open'; + const METHOD = 'POST'; private $ticket; diff --git a/server/controllers/ticket/seen.php b/server/controllers/ticket/seen.php index fa07e0c4..051b3e45 100644 --- a/server/controllers/ticket/seen.php +++ b/server/controllers/ticket/seen.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class SeenController extends Controller { const PATH = '/seen'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/user/ban.php b/server/controllers/user/ban.php index 650c4a73..4cc903b7 100644 --- a/server/controllers/user/ban.php +++ b/server/controllers/user/ban.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class BanUserController extends Controller { const PATH = '/ban'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/user/check-session.php b/server/controllers/user/check-session.php index 88cc8fd3..750bddcd 100644 --- a/server/controllers/user/check-session.php +++ b/server/controllers/user/check-session.php @@ -2,6 +2,7 @@ class CheckSessionController extends Controller { const PATH = '/check-session'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/user/delete.php b/server/controllers/user/delete.php index b17ed8a4..bfc86a06 100644 --- a/server/controllers/user/delete.php +++ b/server/controllers/user/delete.php @@ -6,6 +6,7 @@ DataValidator::with('CustomValidations', true); class DeleteUserController extends Controller { const PATH = '/delete'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/user/edit-email.php b/server/controllers/user/edit-email.php index 5a81ac60..a8bdbdb2 100644 --- a/server/controllers/user/edit-email.php +++ b/server/controllers/user/edit-email.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class EditEmail extends Controller{ const PATH = '/edit-email'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/user/edit-password.php b/server/controllers/user/edit-password.php index de4ef6db..9083aeb5 100644 --- a/server/controllers/user/edit-password.php +++ b/server/controllers/user/edit-password.php @@ -3,7 +3,8 @@ use Respect\Validation\Validator as DataValidator; class EditPassword extends Controller { const PATH = '/edit-password'; - + const METHOD = 'POST'; + public function validations() { return [ 'permission' => 'user', diff --git a/server/controllers/user/get-user.php b/server/controllers/user/get-user.php index ae9b4f9e..6d257f7c 100644 --- a/server/controllers/user/get-user.php +++ b/server/controllers/user/get-user.php @@ -4,7 +4,8 @@ DataValidator::with('CustomValidations', true); class GetUserByIdController extends Controller { const PATH = '/get-user'; - + const METHOD = 'POST'; + public function validations() { return [ 'permission' => 'staff_1', diff --git a/server/controllers/user/get-users.php b/server/controllers/user/get-users.php index 5d8daf28..8f3c6c7a 100644 --- a/server/controllers/user/get-users.php +++ b/server/controllers/user/get-users.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class GetUsersController extends Controller { const PATH = '/get-users'; + const METHOD = 'POST'; public function validations() { return[ diff --git a/server/controllers/user/get.php b/server/controllers/user/get.php index 43f189dd..cbdf931d 100644 --- a/server/controllers/user/get.php +++ b/server/controllers/user/get.php @@ -4,6 +4,7 @@ DataValidator::with('CustomValidations', true); class GetUserController extends Controller { const PATH = '/get'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/user/list-ban.php b/server/controllers/user/list-ban.php index c037eabc..794f3ffd 100644 --- a/server/controllers/user/list-ban.php +++ b/server/controllers/user/list-ban.php @@ -3,6 +3,7 @@ use Respect\Validation\Validator as DataValidator; class ListBanUserController extends Controller { const PATH = '/list-ban'; + const METHOD = 'POST'; public function validations() { return [ diff --git a/server/controllers/user/login.php b/server/controllers/user/login.php index ebd55c30..1465210b 100644 --- a/server/controllers/user/login.php +++ b/server/controllers/user/login.php @@ -2,6 +2,7 @@ class LoginController extends Controller { const PATH = '/login'; + const METHOD = 'POST'; private $userInstance; private $rememberToken; @@ -40,7 +41,7 @@ class LoginController extends Controller { Response::respondSuccess($this->getUserData()); } else { - Response::respondError(ERRORS::INVALID_CREDENTIALS); + Response::respondError(Controller::request('email')); } } diff --git a/server/controllers/user/logout.php b/server/controllers/user/logout.php index 60e51c80..5ba3b4a0 100644 --- a/server/controllers/user/logout.php +++ b/server/controllers/user/logout.php @@ -1,6 +1,7 @@ group($this->groupPath, function () use ($app, $controllers) { foreach ($controllers as $controller) { - $app->post($controller::PATH, $controller->getHandler()); + if($controller::METHOD === 'POST') { + $app->post($controller::PATH, $controller->getHandler()); + } else { + $app->get($controller::PATH, $controller->getHandler()); + } } }); } From 8f02a08018ae078dc2f1c0a9b00b674a7cb61e02 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 9 Feb 2017 17:05:59 -0300 Subject: [PATCH 2/3] Ivan - Update profile pic upload [skip ci] --- .../src/app/admin/panel/staff/staff-editor.js | 45 ++++++++++++++++- .../app/admin/panel/staff/staff-editor.scss | 48 +++++++++++++++++++ server/controllers/staff/edit.php | 5 ++ 3 files changed, 96 insertions(+), 2 deletions(-) diff --git a/client/src/app/admin/panel/staff/staff-editor.js b/client/src/app/admin/panel/staff/staff-editor.js index 1581698f..a173bc1f 100644 --- a/client/src/app/admin/panel/staff/staff-editor.js +++ b/client/src/app/admin/panel/staff/staff-editor.js @@ -1,5 +1,6 @@ import React from 'react'; import _ from 'lodash'; +import classNames from 'classnames'; import i18n from 'lib-app/i18n'; import API from 'lib-app/api-call'; @@ -13,6 +14,8 @@ import FormField from 'core-components/form-field'; import SubmitButton from 'core-components/submit-button'; import Message from 'core-components/message'; import Button from 'core-components/button'; +import Icon from 'core-components/icon'; +import Loading from 'core-components/loading'; class StaffEditor extends React.Component { static propTypes = { @@ -32,6 +35,7 @@ class StaffEditor extends React.Component { email: this.props.email, level: this.props.level - 1, message: null, + loadingPicture: false, departments: this.getUserDepartments() }; @@ -67,9 +71,12 @@ class StaffEditor extends React.Component { -
+
+ {(this.state.loadingPicture) ? : } + +
@@ -195,6 +202,15 @@ class StaffEditor extends React.Component { ); } + getPictureWrapperClass() { + let classes = { + 'staff-editor__card-pic-wrapper': true, + 'staff-editor__card-pic-wrapper_loading': this.state.loadingPicture + }; + + return classNames(classes); + } + getTicketListProps() { return { type: 'secondary', @@ -282,6 +298,31 @@ class StaffEditor extends React.Component { this.setState({message: 'FAIL'}); }); } + + onProfilePicChange(event) { + this.setState({ + loadingPicture: true + }); + + API.call({ + path: '/staff/edit', + data: { + staffId: this.props.staffId, + file: event.target.files[0] + } + }).then(() => { + this.setState({ + loadingPicture: false + }); + + if(this.props.onChange) { + this.props.onChange(); + } + }).catch(() => { + window.scrollTo(0,0); + this.setState({message: 'FAIL', loadingPicture: false}); + }); + } } export default StaffEditor; \ No newline at end of file diff --git a/client/src/app/admin/panel/staff/staff-editor.scss b/client/src/app/admin/panel/staff/staff-editor.scss index 2f601ddd..4b6f8684 100644 --- a/client/src/app/admin/panel/staff/staff-editor.scss +++ b/client/src/app/admin/panel/staff/staff-editor.scss @@ -11,13 +11,41 @@ border: 2px solid $grey; margin-bottom: 20px; + &__image-uploader { + opacity: 0; + } + &-pic { height: 100%; position: absolute; left: 50%; transform: translate(-50%, 0); + &-background { + background-color: black; + opacity: 0; + transition: opacity 0.2s ease; + width: 100%; + height: 100%; + position: absolute; + z-index: 10; + } + + &-icon { + position: absolute; + color: white; + opacity: 0; + transition: opacity 0.2s ease; + top: 70px; + bottom: 0; + left: 0; + right: 0; + z-index: 11; + } + &-wrapper { + transition: opacity 0.2s ease; + background-color: $grey; position: absolute; top: 20px; border: 4px solid $grey; @@ -28,6 +56,26 @@ text-align: center; left: 50%; transform: translate(-50%, 0); + opacity: 1; + + &_loading, + &:hover { + cursor: pointer; + + .staff-editor__card-pic-background { + opacity: 0.6; + } + + .staff-editor__card-pic-icon { + opacity: 0.8; + } + + .staff-editor__card-pic-loading { + position: absolute; + top: 0; + z-index: 11; + } + } } } diff --git a/server/controllers/staff/edit.php b/server/controllers/staff/edit.php index d62b6fb2..05c0b1af 100644 --- a/server/controllers/staff/edit.php +++ b/server/controllers/staff/edit.php @@ -57,6 +57,11 @@ class EditStaffController extends Controller { $this->staffInstance->sharedDepartmentList = $this->getDepartmentList(); } + if(Controller::request('file')) { + $fileUploader = $this->uploadFile(); + $this->staffInstance->profilePic = ($fileUploader instanceof FileUploader) ? $fileUploader->getFileName() : null; + } + $this->staffInstance->store(); } From dcb04f7927ec46143648afa647018812f1e0fbde Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 9 Feb 2017 21:12:38 -0300 Subject: [PATCH 3/3] Ivan - Improve last events animations [skip ci] --- client/package.json | 2 +- .../panel/dashboard/admin-panel-activity.js | 37 ++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/client/package.json b/client/package.json index 0033b6df..22a71851 100644 --- a/client/package.json +++ b/client/package.json @@ -68,7 +68,7 @@ "react-document-title": "^1.0.2", "react-dom": "^15.0.1", "react-google-recaptcha": "^0.5.2", - "react-motion": "^0.4.4", + "react-motion": "^0.4.7", "react-redux": "^4.4.5", "react-router": "^2.4.0", "react-router-redux": "^4.0.5", diff --git a/client/src/app/admin/panel/dashboard/admin-panel-activity.js b/client/src/app/admin/panel/dashboard/admin-panel-activity.js index 251462fb..608cd3c7 100644 --- a/client/src/app/admin/panel/dashboard/admin-panel-activity.js +++ b/client/src/app/admin/panel/dashboard/admin-panel-activity.js @@ -1,4 +1,6 @@ import React from 'react'; +import _ from 'lodash'; +import {TransitionMotion, spring} from 'react-motion'; import API from 'lib-app/api-call'; import i18n from 'lib-app/i18n'; @@ -64,12 +66,30 @@ class AdminPanelActivity extends React.Component { renderList() { return (
- {this.state.activities.map(this.renderRow.bind(this))} + + {this.renderActivityList.bind(this)} + {(!this.state.limit) ? this.renderButton() : null}
); } + renderActivityList(styles) { + return ( +
+ {styles.map(this.renderAnimatedItem.bind(this))} +
+ ); + } + + renderAnimatedItem(config, index) { + return ( +
+ {this.renderRow(config.data, index)} +
+ ); + } + renderButton() { return ( @@ -84,6 +104,21 @@ class AdminPanelActivity extends React.Component { ); } + getStyles() { + return this.state.activities.map((item, index) => ({ + key: index + '', + data: item, + style: {marginTop: spring(0), opacity: spring(1)} + })); + } + + getEnterStyle() { + return { + marginTop: -20, + opacity: 0 + }; + } + onMenuItemClick(index) { this.setState({ page: 1,