mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-11 09:35:00 +00:00
add new feature to substitute user while being admin
This commit is contained in:
parent
cb44d57f2d
commit
d63ec26d8e
31
op/op.ResetSu.php
Normal file
31
op/op.ResetSu.php
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
// MyDMS. Document Management System
|
||||
// Copyright (C) 2013 Uwe Steinmann
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
include("../inc/inc.Settings.php");
|
||||
include("../inc/inc.LogInit.php");
|
||||
include("../inc/inc.DBInit.php");
|
||||
include("../inc/inc.Language.php");
|
||||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
$session->resetSu();
|
||||
|
||||
add_log_line("");
|
||||
header("Location: ../".(isset($settings->_siteDefaultPage) && strlen($settings->_siteDefaultPage)>0 ? $settings->_siteDefaultPage : "out/out.ViewFolder.php?folderid=".$settings->_rootFolderID));
|
||||
|
||||
?>
|
39
op/op.SubstituteUser.php
Normal file
39
op/op.SubstituteUser.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
// MyDMS. Document Management System
|
||||
// Copyright (C) 2013 Uwe Steinmann
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
include("../inc/inc.Settings.php");
|
||||
include("../inc/inc.LogInit.php");
|
||||
include("../inc/inc.DBInit.php");
|
||||
include("../inc/inc.Language.php");
|
||||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
if (!$user->isAdmin()) {
|
||||
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
if (!isset($_GET["userid"])) {
|
||||
UI::exitError(getMLText("admin_tools"),getMLText("unknown_id"));
|
||||
}
|
||||
|
||||
$session->setSu($_GET['userid']);
|
||||
|
||||
add_log_line("?userid=".$_GET["userid"]);
|
||||
header("Location: ../".(isset($settings->_siteDefaultPage) && strlen($settings->_siteDefaultPage)>0 ? $settings->_siteDefaultPage : "out/out.ViewFolder.php?folderid=".$settings->_rootFolderID));
|
||||
|
||||
?>
|
43
out/out.SubstituteUser.php
Normal file
43
out/out.SubstituteUser.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
// MyDMS. Document Management System
|
||||
// Copyright (C) 2013 Uwe Steinmann
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
include("../inc/inc.Settings.php");
|
||||
include("../inc/inc.Utils.php");
|
||||
include("../inc/inc.DBInit.php");
|
||||
include("../inc/inc.Language.php");
|
||||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.ClassAccessOperation.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
if (!$user->isAdmin()) {
|
||||
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
$allUsers = $dms->getAllUsers($settings->_sortUsersInList);
|
||||
|
||||
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
||||
$view = UI::factory($theme, $tmp[1]);
|
||||
if($view) {
|
||||
$view->setParam('dms', $dms);
|
||||
$view->setParam('user', $user);
|
||||
$view->setParam('allusers', $allUsers);
|
||||
$view->show();
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
|
@ -116,60 +116,66 @@ class SeedDMS_Bootstrap_Style extends SeedDMS_View_Common {
|
|||
echo " </a>\n";
|
||||
echo " <a class=\"brand\" href=\"../out/out.ViewFolder.php?folderid=".$this->params['rootfolderid']."\">".(strlen($this->params['sitename'])>0 ? $this->params['sitename'] : "SeedDMS")."</a>\n";
|
||||
if(isset($this->params['user']) && $this->params['user']) {
|
||||
echo " <div class=\"nav-collapse nav-col1\">\n";
|
||||
echo " <ul class=\"nav pull-right\">\n";
|
||||
echo " <li class=\"dropdown\">\n";
|
||||
echo " <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">".getMLText("signed_in_as")." ".htmlspecialchars($this->params['user']->getFullName())."<b class=\"caret\"></b></a>\n";
|
||||
echo " <ul class=\"dropdown-menu\" role=\"menu\">\n";
|
||||
if (!$this->params['user']->isGuest()) {
|
||||
echo " <li><a href=\"../out/out.MyDocuments.php?inProcess=1\">".getMLText("my_documents")."</a></li>\n";
|
||||
echo " <li><a href=\"../out/out.MyAccount.php\">".getMLText("my_account")."</a></li>\n";
|
||||
echo " <li class=\"divider\"></li>\n";
|
||||
}
|
||||
if($this->params['enablelanguageselector']) {
|
||||
echo " <li class=\"dropdown-submenu\">\n";
|
||||
echo " <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">".getMLText("language")."</a>\n";
|
||||
echo " <div class=\"nav-collapse nav-col1\">\n";
|
||||
echo " <ul class=\"nav pull-right\">\n";
|
||||
echo " <li class=\"dropdown\">\n";
|
||||
echo " <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">".($this->params['session']->getSu() ? getMLText("switched_to") : getMLText("signed_in_as"))." '".htmlspecialchars($this->params['user']->getFullName())."' <b class=\"caret\"></b></a>\n";
|
||||
echo " <ul class=\"dropdown-menu\" role=\"menu\">\n";
|
||||
$languages = getLanguages();
|
||||
foreach ($languages as $currLang) {
|
||||
if($this->params['session']->getLanguage() == $currLang)
|
||||
echo "<li class=\"active\">";
|
||||
else
|
||||
echo "<li>";
|
||||
echo "<a href=\"../op/op.SetLanguage.php?lang=".$currLang."&referer=".$_SERVER["REQUEST_URI"]."\">";
|
||||
echo getMLText($currLang)."</a></li>\n";
|
||||
if (!$this->params['user']->isGuest()) {
|
||||
echo " <li><a href=\"../out/out.MyDocuments.php?inProcess=1\">".getMLText("my_documents")."</a></li>\n";
|
||||
echo " <li><a href=\"../out/out.MyAccount.php\">".getMLText("my_account")."</a></li>\n";
|
||||
echo " <li class=\"divider\"></li>\n";
|
||||
}
|
||||
if($this->params['enablelanguageselector']) {
|
||||
echo " <li class=\"dropdown-submenu\">\n";
|
||||
echo " <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">".getMLText("language")."</a>\n";
|
||||
echo " <ul class=\"dropdown-menu\" role=\"menu\">\n";
|
||||
$languages = getLanguages();
|
||||
foreach ($languages as $currLang) {
|
||||
if($this->params['session']->getLanguage() == $currLang)
|
||||
echo "<li class=\"active\">";
|
||||
else
|
||||
echo "<li>";
|
||||
echo "<a href=\"../op/op.SetLanguage.php?lang=".$currLang."&referer=".$_SERVER["REQUEST_URI"]."\">";
|
||||
echo getMLText($currLang)."</a></li>\n";
|
||||
}
|
||||
echo " </ul>\n";
|
||||
echo " </li>\n";
|
||||
if($this->params['user']->isAdmin())
|
||||
echo " <li><a href=\"../out/out.SubstituteUser.php\">".getMLText("substitute_user")."</a></li>\n";
|
||||
echo " <li class=\"divider\"></li>\n";
|
||||
}
|
||||
if($this->params['session']->getSu()) {
|
||||
echo " <li><a href=\"../op/op.ResetSu.php\">".getMLText("sign_out_user")."</a></li>\n";
|
||||
} else {
|
||||
echo " <li><a href=\"../op/op.Logout.php\">".getMLText("sign_out")."</a></li>\n";
|
||||
}
|
||||
echo " </ul>\n";
|
||||
echo " </li>\n";
|
||||
echo " <li class=\"divider\"></li>\n";
|
||||
}
|
||||
echo " <li><a href=\"../op/op.Logout.php\">".getMLText("sign_out")."</a></li>\n";
|
||||
echo " </ul>\n";
|
||||
echo " </li>\n";
|
||||
echo " </ul>\n";
|
||||
echo " </ul>\n";
|
||||
|
||||
echo " <ul class=\"nav\">\n";
|
||||
// echo " <li id=\"first\"><a href=\"../out/out.ViewFolder.php?folderid=".$this->params['rootfolderid']."\">".getMLText("content")."</a></li>\n";
|
||||
// echo " <li><a href=\"../out/out.SearchForm.php?folderid=".$this->params['rootfolderid']."\">".getMLText("search")."</a></li>\n";
|
||||
if ($this->params['enablecalendar']) echo " <li><a href=\"../out/out.Calendar.php?mode=".$this->params['calendardefaultview']."\">".getMLText("calendar")."</a></li>\n";
|
||||
if ($this->params['user']->isAdmin()) echo " <li><a href=\"../out/out.AdminTools.php\">".getMLText("admin_tools")."</a></li>\n";
|
||||
echo " <li><a href=\"../out/out.Help.php\">".getMLText("help")."</a></li>\n";
|
||||
echo " </ul>\n";
|
||||
echo " <form action=\"../op/op.Search.php\" class=\"form-inline navbar-search pull-left\" autocomplete=\"off\">";
|
||||
if ($folder!=null && is_object($folder) && !strcasecmp(get_class($folder), "SeedDMS_Core_Folder")) {
|
||||
echo " <input type=\"hidden\" name=\"folderid\" value=\"".$folder->getID()."\" />";
|
||||
}
|
||||
echo " <input type=\"hidden\" name=\"navBar\" value=\"1\" />";
|
||||
echo " <input type=\"hidden\" name=\"searchin[]\" value=\"1\" />";
|
||||
echo " <input type=\"hidden\" name=\"searchin[]\" value=\"2\" />";
|
||||
echo " <input type=\"hidden\" name=\"searchin[]\" value=\"3\" />";
|
||||
echo " <input name=\"query\" class=\"search-query\" id=\"searchfield\" data-provide=\"typeahead\" type=\"text\" style=\"width: 150px;\" placeholder=\"".getMLText("search")."\"/>";
|
||||
if($this->params['enablefullsearch']) {
|
||||
echo " <label class=\"checkbox\" style=\"color: #999999;\"><input type=\"checkbox\" name=\"fullsearch\" value=\"1\" title=\"".getMLText('fullsearch_hint')."\"/> ".getMLText('fullsearch')."</label>";
|
||||
}
|
||||
// echo " <input type=\"submit\" value=\"".getMLText("search")."\" id=\"searchButton\" class=\"btn\"/>";
|
||||
echo "</form>\n";
|
||||
echo " </div>\n";
|
||||
echo " <ul class=\"nav\">\n";
|
||||
// echo " <li id=\"first\"><a href=\"../out/out.ViewFolder.php?folderid=".$this->params['rootfolderid']."\">".getMLText("content")."</a></li>\n";
|
||||
// echo " <li><a href=\"../out/out.SearchForm.php?folderid=".$this->params['rootfolderid']."\">".getMLText("search")."</a></li>\n";
|
||||
if ($this->params['enablecalendar']) echo " <li><a href=\"../out/out.Calendar.php?mode=".$this->params['calendardefaultview']."\">".getMLText("calendar")."</a></li>\n";
|
||||
if ($this->params['user']->isAdmin()) echo " <li><a href=\"../out/out.AdminTools.php\">".getMLText("admin_tools")."</a></li>\n";
|
||||
echo " <li><a href=\"../out/out.Help.php\">".getMLText("help")."</a></li>\n";
|
||||
echo " </ul>\n";
|
||||
echo " <form action=\"../op/op.Search.php\" class=\"form-inline navbar-search pull-left\" autocomplete=\"off\">";
|
||||
if ($folder!=null && is_object($folder) && !strcasecmp(get_class($folder), "SeedDMS_Core_Folder")) {
|
||||
echo " <input type=\"hidden\" name=\"folderid\" value=\"".$folder->getID()."\" />";
|
||||
}
|
||||
echo " <input type=\"hidden\" name=\"navBar\" value=\"1\" />";
|
||||
echo " <input type=\"hidden\" name=\"searchin[]\" value=\"1\" />";
|
||||
echo " <input type=\"hidden\" name=\"searchin[]\" value=\"2\" />";
|
||||
echo " <input type=\"hidden\" name=\"searchin[]\" value=\"3\" />";
|
||||
echo " <input name=\"query\" class=\"search-query\" id=\"searchfield\" data-provide=\"typeahead\" type=\"text\" style=\"width: 150px;\" placeholder=\"".getMLText("search")."\"/>";
|
||||
if($this->params['enablefullsearch']) {
|
||||
echo " <label class=\"checkbox\" style=\"color: #999999;\"><input type=\"checkbox\" name=\"fullsearch\" value=\"1\" title=\"".getMLText('fullsearch_hint')."\"/> ".getMLText('fullsearch')."</label>";
|
||||
}
|
||||
// echo " <input type=\"submit\" value=\"".getMLText("search")."\" id=\"searchButton\" class=\"btn\"/>";
|
||||
echo "</form>\n";
|
||||
echo " </div>\n";
|
||||
}
|
||||
echo " </div>\n";
|
||||
echo " </div>\n";
|
||||
|
|
83
views/bootstrap/class.SubstituteUser.php
Normal file
83
views/bootstrap/class.SubstituteUser.php
Normal file
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
/**
|
||||
* Implementation of SubstituteUser view
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @license GPL 2
|
||||
* @version @version@
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @copyright Copyright (C) 2002-2005 Markus Westphal,
|
||||
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
|
||||
* 2010-2012 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Include parent class
|
||||
*/
|
||||
require_once("class.Bootstrap.php");
|
||||
|
||||
/**
|
||||
* Class which outputs the html page for SubstituteUser view
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @copyright Copyright (C) 2002-2005 Markus Westphal,
|
||||
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
|
||||
* 2010-2012 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class SeedDMS_View_SubstituteUser extends SeedDMS_Bootstrap_Style {
|
||||
|
||||
function show() { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
$allUsers = $this->params['allusers'];
|
||||
|
||||
$this->htmlStartPage(getMLText("substitute_user"));
|
||||
$this->globalNavigation();
|
||||
$this->contentStart();
|
||||
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
|
||||
|
||||
$this->contentHeading(getMLText("substitute_user"));
|
||||
$this->contentContainerStart();
|
||||
?>
|
||||
<table class="table table-condensed">
|
||||
<tr><th><?php printMLText('name'); ?></th><th><?php printMLText('email');?></th><th><?php printMLText('groups'); ?></th><th></th></tr>
|
||||
<?php
|
||||
foreach ($allUsers as $currUser) {
|
||||
echo "<tr>";
|
||||
echo "<td>";
|
||||
echo $currUser->getFullName()." (".$currUser->getLogin().")<br />";
|
||||
echo "<small>".$currUser->getComment()."</small>";
|
||||
echo "</td>";
|
||||
echo "<td>";
|
||||
echo "<a href=\"mailto:".$currUser->getEmail()."\">".$currUser->getEmail()."</a><br />";
|
||||
echo "</td>";
|
||||
echo "<td>";
|
||||
$groups = $currUser->getGroups();
|
||||
if (count($groups) != 0) {
|
||||
for ($j = 0; $j < count($groups); $j++) {
|
||||
print $groups[$j]->getName();
|
||||
if ($j +1 < count($groups))
|
||||
print ", ";
|
||||
}
|
||||
}
|
||||
echo "</td>";
|
||||
echo "<td>";
|
||||
if($currUser->getID() != $user->getID()) {
|
||||
echo "<a class=\"btn\" href=\"../op/op.SubstituteUser.php?userid=".$currUser->getID()."\"><i class=\"icon-random\"></i> ".getMLText('substitute_user')."</a> ";
|
||||
}
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
$this->contentContainerEnd();
|
||||
|
||||
$this->htmlEndPage();
|
||||
} /* }}} */
|
||||
}
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user