<?php
/**
* iF.SVNAdmin
* Copyright (c) 2010 by Manuel Freiholz
* http://www.insanefactory.com/
*
* 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; version 2
* of the License.
*
* 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( !defined('ACTION_HANDLING') ) {
die("HaHa!");
}
$appEngine->forwardInvalidModule(!$appEngine->isAccessPathEditActive());
$appEngine->checkUserAuthentication(true, ACL_MOD_ACCESSPATH, ACL_ACTION_ADD);
// Check required fields.
$path = get_request_var('path');
if( $path == NULL )
{
$appTemplate->addDefine("WARNING");
$appTemplate->addReplacement("WARNINGMSG",$appTR->tr("You have to fill out all fields."));
}
else
{
$doCreate = true;
$p = new \svnadmin\core\entities\AccessPath();
$p->path = $path;
// Is the user restricted to some paths? (project-manager)
if ($appEngine->isAuthenticationActive())
{
$currentUsername = $appEngine->getSessionUsername();
if ($appEngine->getAclManager()->isUserAccessPathManager($currentUsername))
{
if (!$appEngine->getAclManager()->isUserAdminOfPath($currentUsername, $path))
{
$doCreate = false;
$appTemplate->addDefine("WARNING");
$appTemplate->addReplacement("WARNINGMSG", $appTR->tr("You don't have the permission to create this access path: %0", array($path)));
}
}
}
// Create now.
if ($doCreate)
{
$b = $appEngine->getAccessPathEditProvider()->createAccessPath($p);
if($b)
{
$appEngine->getAccessPathEditProvider()->save();
$appTemplate->addDefine("INFO");
$appTemplate->addReplacement("INFOMSG",$appTR->tr("Done"));
}
else
{
$appTemplate->addDefine("ERROR");
$appTemplate->addReplacement("ERRORMSG","An unknown error occured. Check your configuration, please.");
}
}
}
?>