当前位置: 首页>>代码示例>>PHP>>正文


PHP OC_SubAdmin::isSubAdminofGroup方法代码示例

本文整理汇总了PHP中OC_SubAdmin::isSubAdminofGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_SubAdmin::isSubAdminofGroup方法的具体用法?PHP OC_SubAdmin::isSubAdminofGroup怎么用?PHP OC_SubAdmin::isSubAdminofGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OC_SubAdmin的用法示例。


在下文中一共展示了OC_SubAdmin::isSubAdminofGroup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

<?php

// Init owncloud
require_once '../../lib/base.php';
OC_JSON::checkAdminUser();
OCP\JSON::callCheck();
$username = $_POST["username"];
$group = OC_Util::sanitizeHTML($_POST["group"]);
// Toggle group
if (OC_SubAdmin::isSubAdminofGroup($username, $group)) {
    OC_SubAdmin::deleteSubAdmin($username, $group);
} else {
    OC_SubAdmin::createSubAdmin($username, $group);
}
OC_JSON::success();
开发者ID:noci2012,项目名称:owncloud,代码行数:15,代码来源:togglesubadmins.php

示例2: testRemoveSubAdmin

 public function testRemoveSubAdmin()
 {
     $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\Users::removeSubAdmin(array('userid' => $user2, '_delete' => array('groupid' => $group1)));
     $this->assertInstanceOf('OC_OCS_Result', $result);
     $this->assertTrue($result->succeeded());
     $this->assertTrue(!\OC_SubAdmin::isSubAdminofGroup($user2, $group1));
     \OC_Group::deleteGroup($group1);
     $user1 = $this->generateUsers();
     self::loginAsUser($user1);
     \OC_Group::addToGroup($user1, 'admin');
     $result = \OCA\provisioning_api\Users::removeSubAdmin(array('userid' => $this->getUniqueID(), '_delete' => array('groupid' => $group1)));
     $this->assertInstanceOf('OC_OCS_Result', $result);
     $this->assertEquals(101, $result->getStatusCode());
     $this->assertFalse($result->succeeded());
     $this->resetParams();
     $user1 = $this->generateUsers();
     $user2 = $this->generateUsers();
     self::loginAsUser($user1);
     \OC_Group::addToGroup($user1, 'admin');
     $group1 = $this->getUniqueID();
     \OC_Group::createGroup($group1);
     $_POST['groupid'] = $group1;
     $result = \OCA\provisioning_api\Users::removeSubAdmin(array('userid' => $user2, '_delete' => array('groupid' => $group1)));
     $this->assertInstanceOf('OC_OCS_Result', $result);
     $this->assertFalse($result->succeeded());
     $this->assertEquals(102, $result->getStatusCode());
     \OC_Group::deleteGroup($group1);
 }
开发者ID:samj1912,项目名称:repo,代码行数:35,代码来源:userstest.php

示例3: testRemoveSubAdmin

 public function testRemoveSubAdmin()
 {
     $user1 = $this->generateUsers();
     $user2 = $this->generateUsers();
     $this->userSession->setUser($user1);
     $this->groupManager->get('admin')->addUser($user1);
     $group1 = $this->getUniqueID();
     $group1 = $this->groupManager->createGroup($group1);
     \OC_SubAdmin::createSubAdmin($user2->getUID(), $group1->getGID());
     $result = $this->api->removeSubAdmin(array('userid' => $user2->getUID(), '_delete' => array('groupid' => $group1->getGID())));
     $this->assertInstanceOf('OC_OCS_Result', $result);
     $this->assertTrue($result->succeeded());
     $this->assertTrue(!\OC_SubAdmin::isSubAdminofGroup($user2->getUID(), $group1->getGID()));
     $group1->delete();
     $user1 = $this->generateUsers();
     $this->userSession->setUser($user1);
     $this->groupManager->get('admin')->addUser($user1);
     $result = $this->api->removeSubAdmin(array('userid' => $this->getUniqueID(), '_delete' => array('groupid' => $group1->getGID())));
     $this->assertInstanceOf('OC_OCS_Result', $result);
     $this->assertEquals(101, $result->getStatusCode());
     $this->assertFalse($result->succeeded());
     $this->resetParams();
     $user1 = $this->generateUsers();
     $user2 = $this->generateUsers();
     $this->userSession->setUser($user1);
     $this->groupManager->get('admin')->addUser($user1);
     $group1 = $this->getUniqueID();
     $group1 = $this->groupManager->createGroup($group1);
     $_POST['groupid'] = $group1->getGID();
     $result = $this->api->removeSubAdmin(array('userid' => $user2->getUID(), '_delete' => array('groupid' => $group1->getGID())));
     $this->assertInstanceOf('OC_OCS_Result', $result);
     $this->assertFalse($result->succeeded());
     $this->assertEquals(102, $result->getStatusCode());
     $group1->delete();
 }
开发者ID:jincreator,项目名称:core,代码行数:35,代码来源:userstest.php


注:本文中的OC_SubAdmin::isSubAdminofGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。