本文整理汇总了PHP中OC_Group::deleteGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Group::deleteGroup方法的具体用法?PHP OC_Group::deleteGroup怎么用?PHP OC_Group::deleteGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Group
的用法示例。
在下文中一共展示了OC_Group::deleteGroup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
protected function tearDown()
{
foreach ($this->users as $user) {
\OC_User::deleteUser($user);
}
\OC_Group::deleteGroup('admin');
parent::tearDown();
}
示例2: tearDown
public function tearDown()
{
OC_Mount_Config::$skipTest = false;
\OC_User::deleteUser(self::TEST_USER2);
\OC_User::deleteUser(self::TEST_USER1);
\OC_Group::deleteGroup(self::TEST_GROUP1);
\OC_Group::deleteGroup(self::TEST_GROUP2);
@unlink($this->dataDir . '/mount.json');
OCP\Config::setAppValue('files_external', 'user_mounting_backends', $this->oldAllowedBackends);
}
示例3: tearDownAfterClass
public static function tearDownAfterClass()
{
// cleanup users
\OC_User::deleteUser(self::TEST_FILES_SHARING_API_USER1);
\OC_User::deleteUser(self::TEST_FILES_SHARING_API_USER2);
\OC_User::deleteUser(self::TEST_FILES_SHARING_API_USER3);
// delete group
\OC_Group::deleteGroup(self::TEST_FILES_SHARING_API_GROUP1);
// reset app files_encryption
if (self::$stateFilesEncryption) {
\OC_App::enable('files_encryption');
} else {
\OC_App::disable('files_encryption');
}
}
示例4: OC_wordpress
function OC_wordpress()
{
$this->db_conn = '';
$this->params = array('wordpress_db_host', 'wordpress_db_user', 'wordpress_db_password', 'wordpress_db_name', 'wordpress_db_prefix', 'wordpress_url', 'wordpress_hash_salt', 'wordpress_have_to_be_logged', 'wordpress_global_group', 'wordpress_restrict_group', 'wordpress_add_button');
$this->params = $this->getParams();
if (OC_Appconfig::getValue('user_wordpress', 'clean_groups', 0) == 0 && isset($this->db)) {
$res = $this->db->query('SELECT `blog_id`,`domain` FROM ' . $this->wordpress_db_prefix . 'blogs WHERE `deleted`=0 AND `spam`=0 ');
if ($res->num_rows) {
while ($blog = mysqli_fetch_assoc($res)) {
OC_Group::deleteGroup($blog['domain']);
}
}
OC_Appconfig::setValue('user_wordpress', 'clean_groups', '1');
}
$this->connectdb();
}
示例5: tearDownAfterClass
public static function tearDownAfterClass()
{
// cleanup users
\OC_User::deleteUser(self::TEST_FILES_SHARING_API_USER1);
\OC_User::deleteUser(self::TEST_FILES_SHARING_API_USER2);
\OC_User::deleteUser(self::TEST_FILES_SHARING_API_USER3);
// delete group
\OC_Group::deleteGroup(self::TEST_FILES_SHARING_API_GROUP1);
\OC_Util::tearDownFS();
\OC_User::setUserId('');
Filesystem::tearDown();
// reset backend
\OC_User::clearBackends();
\OC_User::useBackend('database');
\OC_Group::clearBackends();
\OC_Group::useBackend(new \OC_Group_Database());
parent::tearDownAfterClass();
}
示例6: deleteGroup
public static function deleteGroup($parameters)
{
// Check it exists
if (!OC_Group::groupExists($parameters['groupid'])) {
return 101;
} else {
if ($parameters['groupid'] == 'admin') {
// Cannot delete admin group
return 102;
} else {
if (OC_Group::deleteGroup($parameters['groupid'])) {
return 100;
} else {
return 103;
}
}
}
}
示例7: testGetSubAdminsOfGroup
public function testGetSubAdminsOfGroup()
{
$user1 = $this->generateUsers();
$user2 = $this->generateUsers();
self::loginAsUser($user1);
\OC_Group::addToGroup($user1, 'admin');
$group1 = $this->getUniqueID();
\OC_Group::createGroup($group1);
\OC_SubAdmin::createSubAdmin($user2, $group1);
$result = \OCA\provisioning_api\Groups::getSubAdminsOfGroup(array('groupid' => $group1));
$this->assertInstanceOf('OC_OCS_Result', $result);
$this->assertTrue($result->succeeded());
$data = $result->getData();
$this->assertEquals($user2, reset($data));
\OC_Group::deleteGroup($group1);
$user1 = $this->generateUsers();
self::loginAsUser($user1);
\OC_Group::addToGroup($user1, 'admin');
$result = \OCA\provisioning_api\Groups::getSubAdminsOfGroup(array('groupid' => $this->getUniqueID()));
$this->assertInstanceOf('OC_OCS_Result', $result);
$this->assertFalse($result->succeeded());
$this->assertEquals(101, $result->getStatusCode());
}
示例8: array
exit;
}
if (!OC_User::isAdminUser(OC_User::getUser()) && (!OC_SubAdmin::isUserAccessible(OC_User::getUser(), $username) || !OC_SubAdmin::isGroupAccessible(OC_User::getUser(), $group))) {
$l = OC_L10N::get('core');
OC_JSON::error(array('data' => array('message' => $l->t('Authentication error'))));
exit;
}
if (!OC_Group::groupExists($group)) {
OC_Group::createGroup($group);
}
$l = OC_L10N::get('settings');
$error = $l->t("Unable to add user to group %s", $group);
$action = "add";
// Toggle group
if (OC_Group::inGroup($username, $group)) {
$action = "remove";
$error = $l->t("Unable to remove user from group %s", $group);
$success = OC_Group::removeFromGroup($username, $group);
$usersInGroup = OC_Group::usersInGroup($group);
if (count($usersInGroup) == 0) {
OC_Group::deleteGroup($group);
}
} else {
$success = OC_Group::addToGroup($username, $group);
}
// Return Success story
if ($success) {
OC_JSON::success(array("data" => array("username" => $username, "action" => $action, "groupname" => $group)));
} else {
OC_JSON::error(array("data" => array("message" => $error)));
}
示例9: tearDownAfterClass
public static function tearDownAfterClass()
{
// cleanup test user
\OC_User::deleteUser(self::TEST_ENCRYPTION_UTIL_USER1);
\OC_User::deleteUser(self::TEST_ENCRYPTION_UTIL_USER2);
\OC_User::deleteUser(self::TEST_ENCRYPTION_UTIL_LEGACY_USER);
//cleanup groups
\OC_Group::deleteGroup(self::TEST_ENCRYPTION_UTIL_GROUP1);
\OC_Group::deleteGroup(self::TEST_ENCRYPTION_UTIL_GROUP2);
parent::tearDownAfterClass();
}
示例10: array
<?php
// Init owncloud
require_once '../../lib/base.php';
OC_JSON::checkAdminUser();
OCP\JSON::callCheck();
$name = $_POST["groupname"];
// Return Success story
if (OC_Group::deleteGroup($name)) {
OC_JSON::success(array("data" => array("groupname" => $name)));
} else {
OC_JSON::error(array("data" => array("message" => $l->t("Unable to delete group"))));
}
示例11: tearDownAfterClass
public static function tearDownAfterClass()
{
// clean group
\OC_Group::deleteGroup(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1);
// cleanup users
\OC_User::deleteUser(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1);
\OC_User::deleteUser(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2);
\OC_User::deleteUser(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3);
\OC_User::deleteUser(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER4);
}
示例12: testMultiBackend
public function testMultiBackend()
{
$userBackend = new \Test\Util\User\Dummy();
\OC_User::getManager()->registerBackend($userBackend);
$backend1 = new OC_Group_Dummy();
$backend2 = new OC_Group_Dummy();
OC_Group::useBackend($backend1);
OC_Group::useBackend($backend2);
$group1 = $this->getUniqueID();
$group2 = $this->getUniqueID();
OC_Group::createGroup($group1);
//groups should be added to the first registered backend
$this->assertEquals(array($group1), $backend1->getGroups());
$this->assertEquals(array(), $backend2->getGroups());
$this->assertEquals(array($group1), OC_Group::getGroups());
$this->assertTrue(OC_Group::groupExists($group1));
$this->assertFalse(OC_Group::groupExists($group2));
$backend1->createGroup($group2);
$this->assertEquals(array($group1, $group2), OC_Group::getGroups());
$this->assertTrue(OC_Group::groupExists($group1));
$this->assertTrue(OC_Group::groupExists($group2));
$user1 = $this->getUniqueID();
$user2 = $this->getUniqueID();
$userBackend->createUser($user1, '');
$userBackend->createUser($user2, '');
$this->assertFalse(OC_Group::inGroup($user1, $group1));
$this->assertFalse(OC_Group::inGroup($user2, $group1));
$this->assertTrue(OC_Group::addToGroup($user1, $group1));
$this->assertTrue(OC_Group::inGroup($user1, $group1));
$this->assertFalse(OC_Group::inGroup($user2, $group1));
$this->assertFalse($backend2->inGroup($user1, $group1));
OC_Group::addToGroup($user1, $group1);
$this->assertEquals(array($user1), OC_Group::usersInGroup($group1));
$this->assertEquals(array($group1), OC_Group::getUserGroups($user1));
$this->assertEquals(array(), OC_Group::getUserGroups($user2));
OC_Group::deleteGroup($group1);
$this->assertEquals(array(), OC_Group::getUserGroups($user1));
$this->assertEquals(array(), OC_Group::usersInGroup($group1));
$this->assertFalse(OC_Group::inGroup($user1, $group1));
}
示例13: tearDownAfterClass
public static function tearDownAfterClass()
{
// cleanup users
$user = \OC::$server->getUserManager()->get(self::TEST_FILES_SHARING_API_USER1);
if ($user !== null) {
$user->delete();
}
$user = \OC::$server->getUserManager()->get(self::TEST_FILES_SHARING_API_USER2);
if ($user !== null) {
$user->delete();
}
$user = \OC::$server->getUserManager()->get(self::TEST_FILES_SHARING_API_USER3);
if ($user !== null) {
$user->delete();
}
// delete group
\OC_Group::deleteGroup(self::TEST_FILES_SHARING_API_GROUP1);
\OC_Util::tearDownFS();
\OC_User::setUserId('');
Filesystem::tearDown();
// reset backend
\OC_User::clearBackends();
\OC_User::useBackend('database');
\OC_Group::clearBackends();
\OC_Group::useBackend(new \OC\Group\Database());
parent::tearDownAfterClass();
}
示例14: testShareWithGroup
//.........这里部分代码省略.........
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
// Attempt to share back to owner of group share
OC_User::setUserId($this->user2);
$message = 'Sharing test.txt failed, because the user ' . $this->user1 . ' is the original sharer';
try {
OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user1, \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: ' . $message);
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
// Attempt to share back to group
$message = 'Sharing test.txt failed, because this item is already shared with ' . $this->group1;
try {
OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: ' . $message);
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
// Attempt to share back to member of group
$message = 'Sharing test.txt failed, because this item is already shared with ' . $this->user3;
try {
OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: ' . $message);
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
// Unshare
OC_User::setUserId($this->user1);
$this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1));
// Valid share with same person - user then group
$this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE | \OCP\Constants::PERMISSION_SHARE));
$this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE));
OC_User::setUserId($this->user2);
$this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
$this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE | \OCP\Constants::PERMISSION_SHARE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
OC_User::setUserId($this->user3);
$this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
$this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
// Valid reshare
OC_User::setUserId($this->user2);
$this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user4, \OCP\Constants::PERMISSION_READ));
OC_User::setUserId($this->user4);
$this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
// Unshare from user only
OC_User::setUserId($this->user1);
$this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2));
OC_User::setUserId($this->user2);
$this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
OC_User::setUserId($this->user4);
$this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
// Valid share with same person - group then user
OC_User::setUserId($this->user1);
$this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE));
OC_User::setUserId($this->user2);
$this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
$this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
// Unshare from group only
OC_User::setUserId($this->user1);
$this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1));
OC_User::setUserId($this->user2);
$this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
// Attempt user specific target conflict
OC_User::setUserId($this->user3);
$this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE));
OC_User::setUserId($this->user2);
$to_test = OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET);
$this->assertEquals(2, count($to_test));
$this->assertTrue(in_array('test.txt', $to_test));
$this->assertTrue(in_array('test1.txt', $to_test));
// Valid reshare
$this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_USER, $this->user4, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE));
OC_User::setUserId($this->user4);
$this->assertEquals(array('test1.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
// Remove user from group
OC_Group::removeFromGroup($this->user2, $this->group1);
OC_User::setUserId($this->user2);
$this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
OC_User::setUserId($this->user4);
$this->assertEquals(array(), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
// Add user to group
OC_Group::addToGroup($this->user4, $this->group1);
$this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
// Unshare from self
$this->assertTrue(OCP\Share::unshareFromSelf('test', 'test.txt'));
$this->assertEquals(array(), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
OC_User::setUserId($this->user2);
$this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
// Unshare from self via source
OC_User::setUserId($this->user1);
$this->assertTrue(OCP\Share::unshareFromSelf('test', 'share.txt', true));
$this->assertEquals(array(), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
// Remove group
OC_Group::deleteGroup($this->group1);
OC_User::setUserId($this->user4);
$this->assertEquals(array(), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
OC_User::setUserId($this->user3);
$this->assertEquals(array(), OCP\Share::getItemsShared('test'));
}
示例15: tearDownAfterClass
public static function tearDownAfterClass()
{
// cleanup test user
\OC_User::deleteUser(\Test_Encryption_Util::TEST_ENCRYPTION_UTIL_USER1);
\OC_User::deleteUser(\Test_Encryption_Util::TEST_ENCRYPTION_UTIL_USER2);
\OC_User::deleteUser(\Test_Encryption_Util::TEST_ENCRYPTION_UTIL_LEGACY_USER);
//cleanup groups
\OC_Group::deleteGroup(self::TEST_ENCRYPTION_UTIL_GROUP1);
\OC_Group::deleteGroup(self::TEST_ENCRYPTION_UTIL_GROUP2);
\OC_Hook::clear();
\OC_FileProxy::clearProxies();
// Delete keys in /data/
$view = new \OC\Files\View('/');
$view->rmdir('public-keys');
$view->rmdir('owncloud_private_key');
}