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


PHP OC_SubAdmin::createSubAdmin方法代码示例

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


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

示例1: 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());
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:23,代码来源:groupstest.php

示例2:

<?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

示例3: testGetSubAdminsOfGroup

 public function testGetSubAdminsOfGroup()
 {
     $user1 = $this->generateUsers();
     $user2 = $this->generateUsers();
     $this->userSession->setUser($user1);
     $this->groupManager->get('admin')->addUser($user1);
     $group1 = $this->groupManager->createGroup($this->getUniqueID());
     \OC_SubAdmin::createSubAdmin($user2->getUID(), $group1->getGID());
     $result = $this->api->getSubAdminsOfGroup(['groupid' => $group1->getGID()]);
     $this->assertInstanceOf('OC_OCS_Result', $result);
     $this->assertTrue($result->succeeded());
     $data = $result->getData();
     $this->assertEquals($user2->getUID(), reset($data));
     $group1->delete();
     $user1 = $this->generateUsers();
     $this->userSession->setUser($user1);
     $this->groupManager->get('admin')->addUser($user1);
     $result = $this->api->getSubAdminsOfGroup(['groupid' => $this->getUniqueID()]);
     $this->assertInstanceOf('OC_OCS_Result', $result);
     $this->assertFalse($result->succeeded());
     $this->assertEquals(101, $result->getStatusCode());
 }
开发者ID:rosarion,项目名称:core,代码行数:22,代码来源:groupstest.php


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