Skip to content

Instantly share code, notes, and snippets.

@LukasReschke
Created June 26, 2014 19:03
Show Gist options
  • Select an option

  • Save LukasReschke/5482a055a46eee9991ee to your computer and use it in GitHub Desktop.

Select an option

Save LukasReschke/5482a055a46eee9991ee to your computer and use it in GitHub Desktop.
pagecontroller.php
<?php
/**
* ownCloud - passman
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Sander Brand <[email protected]>
* @copyright Sander Brand 2014
*/
namespace OCA\Passman\Controller;
use \OCP\IRequest;
use \OCP\AppFramework\Http\TemplateResponse;
use \OCP\AppFramework\Controller;
class PageController extends Controller {
private $userId;
public function __construct($appName, IRequest $request, $userId){
parent::__construct($appName, $request);
$this->userId = $userId;
}
/**
* CAUTION: the @Stuff turn off security checks, for this page no admin is
* required and no CSRF check. If you don't know what CSRF is, read
* it up in the docs or you might create a security hole. This is
* basically the only required method to add this exemption, don't
* add it to any other method if you don't exactly know what it does
*
* @NoAdminRequired
* @NoCSRFRequired
*/
public function index() {
$params = array('user' => $this->userId);
return new TemplateResponse('passman', 'main', $params); // templates/main.php
}
/**
* @NoCSRFRequired
*/
public function settings() {
$params = array('user' => $this->userId);
return new TemplateResponse('passman', 'main', $params); // templates/main.php
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment