Skip to content

Instantly share code, notes, and snippets.

@xgin
Created November 27, 2014 07:06
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save xgin/adcff22f9a77f66a12d7 to your computer and use it in GitHub Desktop.
Save xgin/adcff22f9a77f66a12d7 to your computer and use it in GitHub Desktop.
Dropbox Backup restricted for non-admin users
<?php
// Copyright 1999-2014. Parallels IP Holdings GmbH. All Rights Reserved.
class Modules_DropboxBackup_CustomButtons extends pm_Hook_CustomButtons
{
public function getButtons()
{
if (!pm_Session::getClient()->isAdmin()) {
return [];
}
return [[
'place' => [self::PLACE_DOMAIN],
'title' => pm_Locale::lmsg('buttonTitle'),
'description' => pm_Locale::lmsg('buttonDescription'),
'link' => pm_Context::getBaseUrl() . '?redirect=domain',
'icon' => pm_Context::getBaseUrl() . 'images/dropbox.png',
]];
}
}
<?php
// Copyright 1999-2014. Parallels IP Holdings GmbH. All Rights Reserved.
$moduleId = basename(dirname(__FILE__));
pm_Context::init($moduleId);
Modules_DropboxBackup_Dropbox::init();
if (!pm_Session::getClient()->isAdmin()) {
throw new pm_Exception('Permission denied');
}
$application = new pm_Application();
$application->run();
@xgin
Copy link
Author

xgin commented Nov 27, 2014

/usr/local/psa/admin/htdocs/modules/dropbox-backup/index.php
/usr/local/psa/admin/plib/modules/dropbox-backup/hooks/CustomButtons.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment