summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
0c02607)
startSUID to use a User object. Fix auth by cookie.
WARNING: this will be removed from the core later.
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
public function doSelfSuid()
{
public function doSelfSuid()
{
- if (!$this->startSUID(S::i('uid'))) {
+ $user =& S::user();
+ if (!$this->startSUID($user)) {
return false;
}
S::set('perms', User::makePerms('user'));
return false;
}
S::set('perms', User::makePerms('user'));
if (!S::logged()) {
S::set('auth', AUTH_COOKIE);
}
if (!S::logged()) {
S::set('auth', AUTH_COOKIE);
}
- return S::i('auth_by_cookie');
+ return User::getSilentWithValues(null, array('user_id' => S::i('auth_by_cookie')));
protected function startSessionAs($user, $level)
{
protected function startSessionAs($user, $level)
{
- if (!($user instanceof User)) {
- $user = User::getSilent($user);
- if ($user === false) {
- return false;
- }
- }
if ((!is_null(S::v('user')) && S::i('user') != $user->id())
|| (S::has('uid') && S::i('uid') != $user->id())) {
return false;
if ((!is_null(S::v('user')) && S::i('user') != $user->id())
|| (S::has('uid') && S::i('uid') != $user->id())) {
return false;
-Subproject commit f1c8bb75eaae934ac2dd1cbd7f8bbc10960413ee
+Subproject commit 0709dd7d7f98df88be921553740e43114fe684f4
{
return array(
'phpinfo' => $this->make_hook('phpinfo', AUTH_MDP, 'admin'),
{
return array(
'phpinfo' => $this->make_hook('phpinfo', AUTH_MDP, 'admin'),
+ 'get_rights' => $this->make_hook('get_rights', AUTH_MDP, 'admin'),
'admin' => $this->make_hook('default', AUTH_MDP, 'admin'),
'admin/ax-xorg' => $this->make_hook('ax_xorg', AUTH_MDP, 'admin'),
'admin/dead-but-active' => $this->make_hook('dead_but_active', AUTH_MDP, 'admin'),
'admin' => $this->make_hook('default', AUTH_MDP, 'admin'),
'admin/ax-xorg' => $this->make_hook('ax_xorg', AUTH_MDP, 'admin'),
'admin/dead-but-active' => $this->make_hook('dead_but_active', AUTH_MDP, 'admin'),
+ function handler_get_rights(&$page, $level)
+ {
+ if (S::suid()) {
+ $page->kill('Déjà en SUID');
+ }
+ $user =& S::user();
+ Platal::session()->startSUID($user, $level);
+
+ pl_redirect('/');
+ }
+
function handler_default(&$page)
{
$page->changeTpl('admin/index.tpl');
function handler_default(&$page)
{
$page->changeTpl('admin/index.tpl');
}
if(Env::has('suid_button') && $registered) {
}
if(Env::has('suid_button') && $registered) {
- if (!Platal::session()->startSUID($user->id())) {
+ if (!Platal::session()->startSUID($user)) {
$page->trigError('Impossible d\'effectuer un SUID sur ' . $user->id());
} else {
pl_redirect("");
$page->trigError('Impossible d\'effectuer un SUID sur ' . $user->id());
} else {
pl_redirect("");