-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'xdmod8.5' into addChartLinkButton
- Loading branch information
Showing
16 changed files
with
568 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
namespace Rest\Controllers; | ||
|
||
use Models\Services\Organizations; | ||
use Silex\Application; | ||
use Silex\ControllerCollection; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use DataWarehouse\Query\Exceptions\BadRequestException; | ||
use XDUser; | ||
use Rest\Utilities\Authentication; | ||
|
||
/** | ||
* @author Greg Dean <[email protected]> | ||
*/ | ||
class AdminControllerProvider extends BaseControllerProvider | ||
{ | ||
public function setupRoutes(Application $app, ControllerCollection $controller) | ||
{ | ||
$root = $this->prefix; | ||
$class = get_class($this); | ||
|
||
$controller->post("$root/reset_user_tour_viewed", "$class::resetUserTourViewed"); | ||
} | ||
|
||
/** | ||
* @param Request $request | ||
* @param Application $app | ||
* @return \Symfony\Component\HttpFoundation\JsonResponse | ||
* @throws \Exception | ||
*/ | ||
public function resetUserTourViewed(Request $request, Application $app) | ||
{ | ||
$this->authorize($request, array('mgr')); | ||
$viewedTour = $this->getIntParam($request, 'viewedTour', true); | ||
$selected_user = XDUser::getUserByID($this->getIntParam($request, 'uid', true)); | ||
|
||
if ($selected_user === null) { | ||
throw new BadRequestException('User not found'); | ||
} | ||
|
||
if (!in_array($viewedTour, [0,1])) { | ||
throw new BadRequestException('Invalid data parameter'); | ||
} | ||
|
||
$storage = new \UserStorage($selected_user, 'viewed_user_tour'); | ||
$storage->upsert(0, ['viewedTour' => $viewedTour]); | ||
|
||
return $app->json( | ||
array( | ||
'success' => true, | ||
'total' => 1, | ||
'message' => 'This user will be now be prompted to view the New User Tour the next time they visit XDMoD' | ||
) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"admin": { | ||
"prefix": "admin", | ||
"controller": "Rest\\Controllers\\AdminControllerProvider" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.