本文整理汇总了PHP中OCP\Util::connectHook方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::connectHook方法的具体用法?PHP Util::connectHook怎么用?PHP Util::connectHook使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\Util
的用法示例。
在下文中一共展示了Util::connectHook方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(IL10N $l, ISession $session, ICredentialsManager $credentialsManager)
{
$this->session = $session;
$this->credentialsManager = $credentialsManager;
$this->setIdentifier('password::logincredentials')->setScheme(self::SCHEME_PASSWORD)->setText($l->t('Log-in credentials, save in database'))->addParameters([]);
\OCP\Util::connectHook('OC_User', 'post_login', $this, 'authenticate');
}
示例2: registerHooks
public static function registerHooks()
{
\OCP\Util::connectHook('OC_Filesystem', 'post_rename', '\\OCA\\Files_Sharing\\Updater', 'renameHook');
\OCP\Util::connectHook('OC_Filesystem', 'post_delete', '\\OCA\\Files_Sharing\\Hooks', 'unshareChildren');
\OCP\Util::connectHook('OC_Appconfig', 'post_set_value', '\\OCA\\Files_Sharing\\Maintainer', 'configChangeHook');
\OCP\Util::connectHook('OC_User', 'post_deleteUser', '\\OCA\\Files_Sharing\\Hooks', 'deleteUser');
}
示例3: setUpBeforeClass
public static function setUpBeforeClass()
{
// reset backend
\OC_User::clearBackends();
\OC_User::useBackend('database');
// enable resharing
\OC_Appconfig::setValue('core', 'shareapi_allow_resharing', 'yes');
// clear share hooks
\OC_Hook::clear('OCP\\Share');
\OC::registerShareHooks();
\OCP\Util::connectHook('OC_Filesystem', 'setup', '\\OC\\Files\\Storage\\Shared', 'setup');
// Sharing related hooks
\OCA\Encryption\Helper::registerShareHooks();
// Filesystem related hooks
\OCA\Encryption\Helper::registerFilesystemHooks();
// clear and register hooks
\OC_FileProxy::clearProxies();
\OC_FileProxy::register(new OCA\Encryption\Proxy());
// create users
\Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1, true);
\Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, true);
\Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3, true);
\Test_Encryption_Util::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER4, true);
// create group and assign users
\OC_Group::createGroup(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1);
\OC_Group::addToGroup(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1);
\OC_Group::addToGroup(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER4, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1);
}
示例4: __construct
public function __construct(IL10N $l, ISession $session, ICrypto $crypto)
{
$this->session = $session;
$this->crypto = $crypto;
$this->setIdentifier('password::sessioncredentials')->setScheme(self::SCHEME_PASSWORD)->setText($l->t('Session credentials'))->addParameters([]);
\OCP\Util::connectHook('OC_User', 'post_login', $this, 'authenticate');
}
示例5: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
// note: not using a data provider because these
// files all need to coexist to make sure the
// share keys are found properly (pattern matching)
self::$testFiles = array('t est.txt', 't est_.txt', 't est.doc.txt', 't est(.*).txt', 'multiple.dots.can.happen.too.txt', 't est.' . self::TEST_ENCRYPTION_HOOKS_USER1 . '.txt', 't est_.' . self::TEST_ENCRYPTION_HOOKS_USER1 . '.shareKey.txt', 'who would upload their.shareKey', 'user ones file.txt', 'user ones file.txt.backup', '.t est.txt');
// reset backend
\OC_User::clearBackends();
\OC_User::useBackend('database');
\OC_Hook::clear('OC_Filesystem');
\OC_Hook::clear('OC_User');
// clear share hooks
\OC_Hook::clear('OCP\\Share');
\OC::registerShareHooks();
\OCP\Util::connectHook('OC_Filesystem', 'setup', '\\OC\\Files\\Storage\\Shared', 'setup');
// Filesystem related hooks
\OCA\Encryption\Helper::registerFilesystemHooks();
// Sharing related hooks
\OCA\Encryption\Helper::registerShareHooks();
// clear and register proxies
\OC_FileProxy::clearProxies();
\OC_FileProxy::register(new OCA\Encryption\Proxy());
// create test user
self::loginHelper(\Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER1, true);
self::loginHelper(\Test_Encryption_Hooks::TEST_ENCRYPTION_HOOKS_USER2, true);
}
示例6: register
public function register()
{
$loginRecord = function ($user) {
$UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined");
Util::writeLog('core', "user:" . User::getDisplayName() . " role:" . $UserRole . " action:login success", Util::INFO);
};
$logoutRecord = function () {
$UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined");
Util::writeLog('core', "user:" . User::getDisplayName() . " role:" . $this->UserRole . " action:logout success", Util::INFO);
};
$createRecord = function ($node) {
$UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined");
Util::writeLog('activity', "user:" . User::getDisplayName() . " role:" . $UserRole . " action:creates " . $node->getName() . " success", Util::INFO);
};
$deleteRecord = function ($node) {
$UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined");
Util::writeLog('activity', "user:" . User::getDisplayName() . " role:" . $UserRole . " action:deletes " . $node->getName() . " success", Util::INFO);
};
$renameRecord = function ($node) {
$UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined");
Util::writeLog('activity', "user:" . User::getDisplayName() . " role:" . $UserRole . " action:renames " . $node->getName() . " success", Util::INFO);
};
$touchRecord = function ($node) {
$UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined");
Util::writeLog('activity', "user:" . User::getDisplayName() . " role:" . $UserRole . " action:touches " . $node->getName() . " success", Util::INFO);
};
Util::connectHook('OCP\\Share', 'post_shared', 'OCA\\Activity_Logging\\UserHooks', 'share');
$this->userManager->listen('\\OC\\User', 'postLogin', $loginRecord);
$this->userManager->listen('\\OC\\User', 'logout', $logoutRecord);
$this->UserFolder->listen('\\OC\\Files', 'postCreate', $createRecord);
$this->UserFolder->listen('\\OC\\Files', 'postDelete', $deleteRecord);
$this->UserFolder->listen('\\OC\\Files', 'postRename', $renameRecord);
}
示例7: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
// reset backend
\OC_User::clearBackends();
\OC_Group::clearBackends();
// clear share hooks
\OC_Hook::clear('OCP\\Share');
\OC::registerShareHooks();
\OCP\Util::connectHook('OC_Filesystem', 'setup', '\\OC\\Files\\Storage\\Shared', 'setup');
// create users
$backend = new \OC_User_Dummy();
\OC_User::useBackend($backend);
$backend->createUser(self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER1);
$backend->createUser(self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_USER2);
$backend->createUser(self::TEST_FILES_SHARING_API_USER3, self::TEST_FILES_SHARING_API_USER3);
// create group
$groupBackend = new \OC_Group_Dummy();
$groupBackend->createGroup(self::TEST_FILES_SHARING_API_GROUP1);
$groupBackend->createGroup('group');
$groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER1, 'group');
$groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER2, 'group');
$groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER3, 'group');
$groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_GROUP1);
\OC_Group::useBackend($groupBackend);
}
示例8: setup
public function setup()
{
Util::connectHook('OC_User', 'post_createUser', $this, 'postCreateUser');
Util::connectHook('OC_User', 'pre_deleteUser', $this, 'preDeleteUser');
Util::connectHook('OC_User', 'post_deleteUser', $this, 'postDeleteUser');
Util::connectHook('OC_User', 'changeUser', $this, 'changeUser');
}
示例9: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
// remember files_encryption state
self::$stateFilesEncryption = \OC_App::isEnabled('files_encryption');
//we don't want to tests with app files_encryption enabled
\OC_App::disable('files_encryption');
// reset backend
\OC_User::clearBackends();
\OC_User::useBackend('database');
// clear share hooks
\OC_Hook::clear('OCP\\Share');
\OC::registerShareHooks();
\OCP\Util::connectHook('OC_Filesystem', 'setup', '\\OC\\Files\\Storage\\Shared', 'setup');
// create users
$backend = new \OC_User_Dummy();
\OC_User::useBackend($backend);
$backend->createUser(self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER1);
$backend->createUser(self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_USER2);
$backend->createUser(self::TEST_FILES_SHARING_API_USER3, self::TEST_FILES_SHARING_API_USER3);
// create group
$groupBackend = new \OC_Group_Dummy();
$groupBackend->createGroup(self::TEST_FILES_SHARING_API_GROUP1);
$groupBackend->createGroup('group');
$groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER1, 'group');
$groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER2, 'group');
$groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER3, 'group');
$groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_GROUP1);
\OC_Group::useBackend($groupBackend);
}
示例10: register
/**
* Registers the filesystem hooks for basic filesystem operations.
* All other events has to be triggered by the apps.
*/
public static function register()
{
Util::connectHook('OC_Filesystem', 'post_create', 'OCA\\Activity\\FilesHooksStatic', 'fileCreate');
Util::connectHook('OC_Filesystem', 'post_update', 'OCA\\Activity\\FilesHooksStatic', 'fileUpdate');
Util::connectHook('OC_Filesystem', 'delete', 'OCA\\Activity\\FilesHooksStatic', 'fileDelete');
Util::connectHook('\\OCA\\Files_Trashbin\\Trashbin', 'post_restore', 'OCA\\Activity\\FilesHooksStatic', 'fileRestore');
Util::connectHook('OCP\\Share', 'post_shared', 'OCA\\Activity\\FilesHooksStatic', 'share');
}
示例11: addHooks
/**
* Connects Hooks
*
* @return null
*/
public function addHooks()
{
OCUtil::connectHook('OC_User', 'post_login', $this, 'login');
OCUtil::connectHook('OC_User', 'logout', $this, 'logout');
OCUtil::connectHook('OC_User', 'post_setPassword', $this, 'setPassphrase');
OCUtil::connectHook('OC_User', 'pre_setPassword', $this, 'preSetPassphrase');
OCUtil::connectHook('OC_User', 'post_createUser', $this, 'postCreateUser');
OCUtil::connectHook('OC_User', 'post_deleteUser', $this, 'postDeleteUser');
}
示例12: setUp
public function setUp()
{
self::$hookCalls = array();
$config = \OC::$server->getConfig();
$this->dataDir = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data/');
\OC_Mount_Config::$skipTest = true;
\OCP\Util::connectHook(Filesystem::CLASSNAME, Filesystem::signal_create_mount, get_class($this), 'createHookCallback');
\OCP\Util::connectHook(Filesystem::CLASSNAME, Filesystem::signal_delete_mount, get_class($this), 'deleteHookCallback');
}
示例13: connectHooks
public function connectHooks()
{
\OCP\Util::connectHook('OC_User', 'pre_setPassword', $this, 'pre_setPasswordHook');
\OCP\Util::connectHook('OC_User', 'post_setPassword', $this, 'post_setPasswordHook');
\OCP\Util::connectHook('OC_User', 'pre_createUser', $this, 'pre_createUserHook');
\OCP\Util::connectHook('OC_User', 'post_createUser', $this, 'post_createUserHook');
\OCP\Util::connectHook('OC_User', 'pre_deleteUser', $this, 'pre_deleteUserHook');
\OCP\Util::connectHook('OC_User', 'post_deleteUser', $this, 'post_deleteUserHook');
}
示例14: setUpHooks
public static function setUpHooks()
{
self::clear();
\OCP\Util::connectHook(Filesystem::CLASSNAME, Filesystem::signal_create, '\\Test\\HookHelper', 'createCallback');
\OCP\Util::connectHook(Filesystem::CLASSNAME, Filesystem::signal_update, '\\Test\\HookHelper', 'updateCallback');
\OCP\Util::connectHook(Filesystem::CLASSNAME, Filesystem::signal_write, '\\Test\\HookHelper', 'writeCallback');
\OCP\Util::connectHook(Filesystem::CLASSNAME, Filesystem::signal_post_create, '\\Test\\HookHelper', 'postCreateCallback');
\OCP\Util::connectHook(Filesystem::CLASSNAME, Filesystem::signal_post_update, '\\Test\\HookHelper', 'postUpdateCallback');
\OCP\Util::connectHook(Filesystem::CLASSNAME, Filesystem::signal_post_write, '\\Test\\HookHelper', 'postWriteCallback');
}
示例15: register
/**
* Registers the filesystem hooks for basic filesystem operations.
* All other events has to be triggered by the apps.
*/
public static function register()
{
Util::connectHook('OC_Filesystem', 'post_create', 'OCA\\Activity\\FilesHooksStatic', 'fileCreate');
Util::connectHook('OC_Filesystem', 'post_update', 'OCA\\Activity\\FilesHooksStatic', 'fileUpdate');
Util::connectHook('OC_Filesystem', 'delete', 'OCA\\Activity\\FilesHooksStatic', 'fileDelete');
Util::connectHook('\\OCA\\Files_Trashbin\\Trashbin', 'post_restore', 'OCA\\Activity\\FilesHooksStatic', 'fileRestore');
Util::connectHook('OCP\\Share', 'post_shared', 'OCA\\Activity\\FilesHooksStatic', 'share');
$eventDispatcher = \OC::$server->getEventDispatcher();
$eventDispatcher->addListener('OCA\\Files::loadAdditionalScripts', ['OCA\\Activity\\FilesHooksStatic', 'onLoadFilesAppScripts']);
}