| Copyright: See the COPYRIGHT.txt file.                                    |
| License: GPLv2 or later, see the LICENSE.txt file.                        |
+---------------------------------------------------------------------------+
*/
// Require the initialisation file
require_once '../../init.php';
// Required files
require_once MAX_PATH . '/lib/OA/Dal.php';
require_once MAX_PATH . '/www/admin/config.php';
require_once MAX_PATH . '/lib/OA/Session.php';
require_once MAX_PATH . '/lib/OA/Admin/UI/UserAccess.php';
// Register input variables
phpAds_registerGlobal('userid', 'returnurl');
// Security check
OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN);
$doAccounts = OA_Dal::factoryDO('accounts');
$accountId = $doAccounts->getAdminAccountId();
/*-------------------------------------------------------*/
/* Main code                                             */
/*-------------------------------------------------------*/
if (!empty($accountId) && !empty($userid)) {
    if (OA_Admin_UI_UserAccess::countNumberOfUserLinkedToAccount($accountId) > 1) {
        OA_Admin_UI_UserAccess::unlinkUserFromAccount($accountId, $userid);
    } else {
        OA_Session::setMessage($GLOBALS['strCantDeleteOneAdminUser']);
    }
}
if (empty($returnurl)) {
    $returnurl = 'admin-access.php';
}
Header("Location: " . $returnurl);
Beispiel #2
0
    }
} else {
    MAX_displayInventoryBreadcrumbs(array(array("name" => phpAds_getClientName($agencyid))), "agency");
    phpAds_PageHeader("4.1.1");
    phpAds_ShowSections(array("4.1.1"));
}
$tabindex = 1;
/*-------------------------------------------------------*/
/* Main code                                             */
/*-------------------------------------------------------*/
require_once MAX_PATH . '/lib/OA/Admin/Template.php';
$oTpl = new OA_Admin_Template('agency-access.html');
// Ensure that any template variables for the authentication plugin are set
$oPlugin = OA_Auth::staticGetAuthPlugin();
$oPlugin->setTemplateVariables($oTpl);
$oTpl->assign('infomessage', OA_Session::getMessage());
$oTpl->assign('entityIdName', 'agencyid');
$oTpl->assign('entityIdValue', $agencyid);
$oTpl->assign('editPage', 'agency-user.php');
$oTpl->assign('unlinkPage', 'agency-user-unlink.php');
$doUsers = OA_Dal::factoryDO('users');
$oTpl->assign('users', array('aUsers' => $doUsers->getAccountUsersByEntity('agency', $agencyid)));
$oTpl->display();
/*-------------------------------------------------------*/
/* HTML framework                                        */
/*-------------------------------------------------------*/
phpAds_PageFooter();
function addPageTools($agencyId)
{
    addPageLinkTool($GLOBALS["strLinkUser_Key"], "agency-user-start.php?agencyid={$agencyId}", "iconAdvertiserAdd", $GLOBALS["strAddNew"]);
}
Beispiel #3
0
 /**
  * Links user with account and set apropriate messages.
  * Common method reused across user access pages
  *
  * @param integer $userId  User ID
  * @param integer $accountId  Account ID
  * @param array $permissions Array of permissions
  * @param array $aAllowedPermissions  Array of allowed permissions
  */
 function linkUserToAccount($userId, $accountId, $permissions, $aAllowedPermissions)
 {
     if (!empty($userId)) {
         if (!OA_Permission::isUserLinkedToAccount($accountId, $userId)) {
             OA_Session::setMessage($GLOBALS['strUserLinkedToAccount']);
         } else {
             OA_Session::setMessage($GLOBALS['strUserAccountUpdated']);
         }
         OA_Permission::setAccountAccess($accountId, $userId);
         OA_Permission::storeUserAccountsPermissions($permissions, $accountId, $userId, $aAllowedPermissions);
     }
 }