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


PHP OC_Group::usersInGroup方法代码示例

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


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

示例1: getGroup

 /**
  * returns an array of users in the group specified
  */
 public static function getGroup($parameters)
 {
     // Check the group exists
     if (!OC_Group::groupExists($parameters['groupid'])) {
         return 101;
     }
     return array('users' => OC_Group::usersInGroup($parameters['groupid']));
 }
开发者ID:blablubli,项目名称:owncloudapps,代码行数:11,代码来源:groups.php

示例2: testSingleBackend

 function testSingleBackend()
 {
     OC_Group::useBackend(new OCA\user_ldap\GROUP_LDAP());
     $group_ldap = new OCA\user_ldap\GROUP_LDAP();
     $this->assertIsA(OC_Group::getGroups(), gettype(array()));
     $this->assertIsA($group_ldap->getGroups(), gettype(array()));
     $this->assertFalse(OC_Group::inGroup('john', 'dosers'), gettype(false));
     $this->assertFalse($group_ldap->inGroup('john', 'dosers'), gettype(false));
     //TODO: check also for expected true result. This backend won't be able to do any modifications, maybe use a dummy for this.
     $this->assertIsA(OC_Group::getUserGroups('john doe'), gettype(array()));
     $this->assertIsA($group_ldap->getUserGroups('john doe'), gettype(array()));
     $this->assertIsA(OC_Group::usersInGroup('campers'), gettype(array()));
     $this->assertIsA($group_ldap->usersInGroup('campers'), gettype(array()));
 }
开发者ID:ryanshoover,项目名称:core,代码行数:14,代码来源:group_ldap.php

示例3: setValue

 public function setValue($app, $key, $value)
 {
     $type = Extension\ConfigHistory::ADMIN_OPERATION;
     $user = User::getUser();
     $inserted = false;
     if (!$this->hasKey($app, $key)) {
         $inserted = (bool) $this->conn->insertIfNotExist("*PREFIX*appconfig", ["appid" => $app, "configkey" => $key, "configvalue" => $value], ["appid", "configkey"]);
     }
     if (!$inserted) {
         $subject = "update_value";
     } else {
         $subject = "create_value";
     }
     if (!$this->match($app, $key)) {
         $usersInGroup = \OC_Group::usersInGroup("admin");
         foreach ($usersInGroup as $affecteduser) {
             $event = new Event();
             $event->setApp($app)->setType($type)->setAffectedUser($user)->setAuthor($this->currentUID)->setTimestamp(time())->setSubject($subject, array($user, $key, $value));
             $this->data->send($event);
         }
     }
     parent::setValue($app, $key, $value);
 }
开发者ID:inwinstack,项目名称:owncloud-config_history,代码行数:23,代码来源:confighistoryappconfig.php

示例4: postUnshareFromSelfHook

 /**
  * update etags if file was unshared from self
  * @param array $params
  */
 public static function postUnshareFromSelfHook($params)
 {
     if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') {
         foreach ($params['unsharedItems'] as $item) {
             if ($item['shareType'] === \OCP\Share::SHARE_TYPE_GROUP) {
                 foreach (\OC_Group::usersInGroup($item['shareWith']) as $user) {
                     self::correctUsersFolder($user, $item['fileTarget']);
                 }
             } else {
                 self::correctUsersFolder($item['shareWith'], $item['fileTarget']);
             }
         }
     }
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:18,代码来源:updater.php

示例5: 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)));
}
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:31,代码来源:togglegroups.php

示例6: getUserWithAccessToMountPoint

 private function getUserWithAccessToMountPoint($users, $groups)
 {
     $result = array();
     if (in_array('all', $users)) {
         $result = \OCP\User::getUsers();
     } else {
         $result = array_merge($result, $users);
         foreach ($groups as $group) {
             $result = array_merge($result, \OC_Group::usersInGroup($group));
         }
     }
     return $result;
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:13,代码来源:util.php

示例7: put

 /**
  * Put shared item into the database
  * @param string $itemType Item type
  * @param string $itemSource Item source
  * @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK
  * @param string $shareWith User or group the item is being shared with
  * @param string $uidOwner User that is the owner of shared item
  * @param int $permissions CRUDS permissions
  * @param boolean|array $parentFolder Parent folder target (optional)
  * @param string $token (optional)
  * @param string $itemSourceName name of the source item (optional)
  * @param \DateTime $expirationDate (optional)
  * @throws \Exception
  * @return mixed id of the new share or false
  */
 private static function put($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, $parentFolder = null, $token = null, $itemSourceName = null, \DateTime $expirationDate = null)
 {
     $queriesToExecute = array();
     $suggestedItemTarget = null;
     $groupFileTarget = $fileTarget = $suggestedFileTarget = $filePath = '';
     $groupItemTarget = $itemTarget = $fileSource = $parent = 0;
     $result = self::checkReshare($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, $itemSourceName, $expirationDate);
     if (!empty($result)) {
         $parent = $result['parent'];
         $itemSource = $result['itemSource'];
         $fileSource = $result['fileSource'];
         $suggestedItemTarget = $result['suggestedItemTarget'];
         $suggestedFileTarget = $result['suggestedFileTarget'];
         $filePath = $result['filePath'];
     }
     $isGroupShare = false;
     if ($shareType == self::SHARE_TYPE_GROUP) {
         $isGroupShare = true;
         if (isset($shareWith['users'])) {
             $users = $shareWith['users'];
         } else {
             $users = \OC_Group::usersInGroup($shareWith['group']);
         }
         // remove current user from list
         if (in_array(\OCP\User::getUser(), $users)) {
             unset($users[array_search(\OCP\User::getUser(), $users)]);
         }
         $groupItemTarget = Helper::generateTarget($itemType, $itemSource, $shareType, $shareWith['group'], $uidOwner, $suggestedItemTarget);
         $groupFileTarget = Helper::generateTarget($itemType, $itemSource, $shareType, $shareWith['group'], $uidOwner, $filePath);
         // add group share to table and remember the id as parent
         $queriesToExecute['groupShare'] = array('itemType' => $itemType, 'itemSource' => $itemSource, 'itemTarget' => $groupItemTarget, 'shareType' => $shareType, 'shareWith' => $shareWith['group'], 'uidOwner' => $uidOwner, 'permissions' => $permissions, 'shareTime' => time(), 'fileSource' => $fileSource, 'fileTarget' => $groupFileTarget, 'token' => $token, 'parent' => $parent, 'expiration' => $expirationDate);
     } else {
         $users = array($shareWith);
         $itemTarget = Helper::generateTarget($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $suggestedItemTarget);
     }
     $run = true;
     $error = '';
     $preHookData = array('itemType' => $itemType, 'itemSource' => $itemSource, 'shareType' => $shareType, 'uidOwner' => $uidOwner, 'permissions' => $permissions, 'fileSource' => $fileSource, 'expiration' => $expirationDate, 'token' => $token, 'run' => &$run, 'error' => &$error);
     $preHookData['itemTarget'] = $isGroupShare ? $groupItemTarget : $itemTarget;
     $preHookData['shareWith'] = $isGroupShare ? $shareWith['group'] : $shareWith;
     \OC_Hook::emit('OCP\\Share', 'pre_shared', $preHookData);
     if ($run === false) {
         throw new \Exception($error);
     }
     foreach ($users as $user) {
         $sourceId = $itemType === 'file' || $itemType === 'folder' ? $fileSource : $itemSource;
         $sourceExists = self::getItemSharedWithBySource($itemType, $sourceId, self::FORMAT_NONE, null, true, $user);
         $userShareType = $isGroupShare ? self::$shareTypeGroupUserUnique : $shareType;
         if ($sourceExists && $sourceExists['item_source'] === $itemSource) {
             $fileTarget = $sourceExists['file_target'];
             $itemTarget = $sourceExists['item_target'];
             // for group shares we don't need a additional entry if the target is the same
             if ($isGroupShare && $groupItemTarget === $itemTarget) {
                 continue;
             }
         } elseif (!$sourceExists && !$isGroupShare) {
             $itemTarget = Helper::generateTarget($itemType, $itemSource, $userShareType, $user, $uidOwner, $suggestedItemTarget, $parent);
             if (isset($fileSource)) {
                 if ($parentFolder) {
                     if ($parentFolder === true) {
                         $fileTarget = Helper::generateTarget('file', $filePath, $userShareType, $user, $uidOwner, $suggestedFileTarget, $parent);
                         if ($fileTarget != $groupFileTarget) {
                             $parentFolders[$user]['folder'] = $fileTarget;
                         }
                     } else {
                         if (isset($parentFolder[$user])) {
                             $fileTarget = $parentFolder[$user]['folder'] . $itemSource;
                             $parent = $parentFolder[$user]['id'];
                         }
                     }
                 } else {
                     $fileTarget = Helper::generateTarget('file', $filePath, $userShareType, $user, $uidOwner, $suggestedFileTarget, $parent);
                 }
             } else {
                 $fileTarget = null;
             }
         } else {
             // group share which doesn't exists until now, check if we need a unique target for this user
             $itemTarget = Helper::generateTarget($itemType, $itemSource, self::SHARE_TYPE_USER, $user, $uidOwner, $suggestedItemTarget, $parent);
             // do we also need a file target
             if (isset($fileSource)) {
                 $fileTarget = Helper::generateTarget('file', $filePath, self::SHARE_TYPE_USER, $user, $uidOwner, $suggestedFileTarget, $parent);
             } else {
                 $fileTarget = null;
             }
//.........这里部分代码省略.........
开发者ID:evanjt,项目名称:core,代码行数:101,代码来源:share.php

示例8: sendEmails

 /**
  * @brief use to create HTML emails and send them
  * @param $eventid The event id
  * @param $location The location
  * @param $description The description
  * @param $dtstart The start date
  * @param $dtend The end date
  *
  */
 public static function sendEmails($eventid, $summary, $location, $description, $dtstart, $dtend)
 {
     $user = \OCP\User::getUser();
     $eventsharees = array();
     $eventShareesNames = array();
     $emails = array();
     $sharedwithByEvent = \OCP\Share::getItemShared('event', $eventid);
     if (is_array($sharedwithByEvent)) {
         foreach ($sharedwithByEvent as $share) {
             if ($share['share_type'] === \OCP\Share::SHARE_TYPE_USER || $share['share_type'] === \OCP\Share::SHARE_TYPE_GROUP) {
                 $eventsharees[] = $share;
             }
         }
         foreach ($eventsharees as $sharee) {
             $shwth = $sharee['share_with'];
             if ($sharee['share_type'] == \OCP\Share::SHARE_TYPE_GROUP) {
                 foreach (OC_Group::usersInGroup($shwth) as $u) {
                     if (!in_array($u, $eventShareesNames)) {
                         $eventShareesNames[] = $u;
                     }
                 }
             } else {
                 if (!in_array($shwth, $eventShareesNames)) {
                     $eventShareesNames[] = $shwth;
                 }
             }
         }
     }
     foreach ($eventShareesNames as $name) {
         $result = OC_Calendar_Calendar::getUsersEmails($name);
         $emails[] = $result;
     }
     $adminmail = \OCP\Util::getDefaultEmailAddress('no-reply');
     foreach ($emails as $email) {
         if ($email === null) {
             continue;
         }
         $subject = 'Calendar Event Shared';
         $message = '<html><body>';
         $message .= '<table style="border:1px solid black;" cellpadding="10">';
         $message .= "<tr style='background: #eee;'><td colspan='2'><strong>" . $user . '</strong><strong> has shared with you an event</strong></td></tr>';
         $message .= '<tr><td><strong>Summary:</strong> </td><td>' . \OCP\Util::sanitizeHTML($summary) . '</td></tr>';
         $message .= '<tr><td><strong>Location:</strong> </td><td>' . \OCP\Util::sanitizeHTML($location) . '</td></tr>';
         $message .= '<tr><td><strong>Description:</strong> </td><td>' . \OCP\Util::sanitizeHTML($description) . '</td></tr>';
         $message .= '</table>';
         $message .= '</body></html>';
         OCP\Util::sendMail($email, \OCP\User::getDisplayName(), $subject, $message, $adminmail, $user, $html = 1);
     }
 }
开发者ID:yheric455042,项目名称:owncloud82,代码行数:58,代码来源:app.php

示例9: 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));
 }
开发者ID:evanjt,项目名称:core,代码行数:40,代码来源:group.php

示例10: getRooms

	public static function getRooms() {
		$grooms = array();
		$urooms = array();
		$userId = OC_User::getUser();
		$ordering = array();
		// add groups the user contains if more than the user himself is in the room
		foreach (OC_Group::getUserGroups($userId) as $group) {
			if ( count(OC_Group::usersInGroup($group)) > 1 ) {
				$grooms["group:".$group] = array( "type" => "group", "name" => $group );
				/*if ( UC_ROOM_ONLY_MSGS ) { // TODO: option: maybe private msgs only to users in same rooms ?					
				} */
			}
		}
		// if no group exist create default; NEW in 0.2: no default room!
		//if ( empty($grooms) )
		//	$grooms["group:default"] = array( "type" => "group", "name" => "default" );

		// add all other users
		if ( UC_SINGLE_USER_MSG == true ) {
			foreach (OC_User::getUsers() as $user) {
				if ( $userId != $user ) {
					$urooms["user:".$user] = array( "type" => "user", "name" => $user );
				}
			}
		}
		$rooms = $grooms + $urooms; 
		return $rooms;
	}	
开发者ID:ArcherSys,项目名称:ArcherSysOSCloud7,代码行数:28,代码来源:conversations.php

示例11: prepareActivityLog

 public static function prepareActivityLog($shareData)
 {
     $aApp = array(App::SHARECALENDAR => 'calendar', App::SHAREEVENT => 'calendar', App::SHARETODO => App::SHARECALENDAR);
     //shared_with_by, shared_user_self,shared_group_self,shared_link_self
     if (array_key_exists($shareData['itemType'], $aApp)) {
         $sType = '';
         $sL10nDescr = '';
         if ($shareData['itemType'] === App::SHARECALENDAR) {
             $sType = App::SHARECALENDARPREFIX;
             $sL10nDescr = 'calendar';
         }
         if ($shareData['itemType'] === App::SHAREEVENT) {
             $sType = App::SHAREEVENTPREFIX;
             $sL10nDescr = 'event';
         }
         if ($shareData['itemType'] === App::SHARETODO) {
             $sType = App::SHARETODOPREFIX;
             $sL10nDescr = 'todo';
         }
         $sApp = $aApp[$shareData['itemType']];
         $l = \OC::$server->getL10N(App::$appname);
         $type = 'shared_' . $sApp;
         if ($shareData['token'] !== '' && $shareData['shareType'] === \OCP\Share::SHARE_TYPE_LINK) {
             $shareData['itemSource'] = App::validateItemSource($shareData['itemSource'], $sType);
             if ($shareData['itemType'] === App::SHAREEVENT || $shareData['itemType'] === App::SHARECALENDAR) {
                 $link = \OC::$server->getURLGenerator()->linkToRoute(App::$appname . '.public.index', ['token' => $shareData['token']]);
             }
             if ($shareData['itemType'] === App::SHARETODO) {
                 $link = \OC::$server->getURLGenerator()->linkToRoute('tasksplus.public.index', ['token' => $shareData['token']]);
             }
             if ($shareData['itemType'] === App::SHAREEVENT || $shareData['itemType'] === App::SHARETODO) {
                 $aObject = Object::find($shareData['itemSource']);
                 $aCalendar = Calendar::find($aObject['calendarid']);
                 $description = $l->t($sL10nDescr) . ' ' . $aObject['summary'] . ' (' . $l->t('calendar') . ' ' . $aCalendar['displayname'] . ')';
             } else {
                 $description = $l->t($sL10nDescr) . ' ' . $shareData['itemTarget'];
             }
             \OC::$server->getActivityManager()->publishActivity(App::$appname, 'shared_link_self_' . $sApp, array($description), '', '', '', $link, \OCP\User::getUser(), $type, '');
         }
         if ($shareData['shareType'] === \OCP\Share::SHARE_TYPE_USER) {
             $link = '';
             $shareData['itemSource'] = App::validateItemSource($shareData['itemSource'], $sType);
             if ($shareData['itemType'] === App::SHARETODO) {
                 $link = \OC::$server->getURLGenerator()->linkToRoute('tasksplus.page.index') . '#' . urlencode($shareData['itemSource']);
             }
             if ($shareData['itemType'] === App::SHAREEVENT) {
                 $link = \OC::$server->getURLGenerator()->linkToRoute(App::$appname . '.page.index') . '#' . urlencode($shareData['itemSource']);
             }
             $description = $shareData['itemTarget'];
             if ($shareData['itemType'] === App::SHARETODO || $shareData['itemType'] === App::SHAREEVENT) {
                 $aObject = Object::find($shareData['itemSource']);
                 $aCalendar = Calendar::find($aObject['calendarid']);
                 $description = $aObject['summary'] . ' (' . $l->t('calendar') . ' ' . $aCalendar['displayname'] . ')';
             }
             \OC::$server->getActivityManager()->publishActivity(App::$appname, 'shared_user_self_' . $sApp, array($l->t($sL10nDescr) . ' ' . $description, $shareData['shareWith']), '', '', '', $link, \OCP\User::getUser(), $type, '');
             \OC::$server->getActivityManager()->publishActivity(App::$appname, 'shared_with_by_' . $sApp, array($l->t($sL10nDescr) . ' ' . $description, \OCP\User::getUser()), '', '', '', $link, $shareData['shareWith'], $type, '');
         }
         if ($shareData['shareType'] === \OCP\Share::SHARE_TYPE_GROUP) {
             $link = '';
             $shareData['itemSource'] = App::validateItemSource($shareData['itemSource'], $sType);
             if ($shareData['itemType'] === App::SHARETODO) {
                 $link = \OC::$server->getURLGenerator()->linkToRoute('tasksplus.page.index') . '#' . urlencode($shareData['itemSource']);
             }
             if ($shareData['itemType'] === App::SHAREEVENT) {
                 $link = \OC::$server->getURLGenerator()->linkToRoute('calendar.page.index') . '#' . urlencode($shareData['itemSource']);
             }
             $description = $shareData['itemTarget'];
             if ($shareData['itemType'] === App::SHARETODO || $shareData['itemType'] === App::SHAREEVENT) {
                 $aObject = Object::find($shareData['itemSource']);
                 $aCalendar = Calendar::find($aObject['calendarid']);
                 $description = $aObject['summary'] . ' (' . $l->t('calendar') . ' ' . $aCalendar['displayname'] . ')';
             }
             \OC::$server->getActivityManager()->publishActivity(App::$appname, 'shared_group_self_' . $sApp, array($l->t($sL10nDescr) . ' ' . $description, $shareData['shareWith']), '', '', '', $link, \OCP\User::getUser(), $type, '');
             $usersInGroup = \OC_Group::usersInGroup($shareData['shareWith']);
             foreach ($usersInGroup as $user) {
                 \OC::$server->getActivityManager()->publishActivity(App::$appname, 'shared_with_by_' . $sApp, array($l->t($sL10nDescr) . ' ' . $description, \OCP\User::getUser()), '', '', '', $link, $user, 'shared_' . $sApp, '');
             }
         }
     }
 }
开发者ID:Rotzbua,项目名称:calendarplus,代码行数:80,代码来源:hooks.php

示例12: foreach

$groups[] = "<optgroup label='Groups'>";
if (OCP\Config::getAppValue('files_sharing', 'allowSharingWithEveryone', 'no') == 'yes') {
    $allGroups = OC_Group::getGroups();
    foreach ($allGroups as $group) {
        $groups[] = "<option value='" . $group . "(group)'>" . $group . " (group) </option>";
    }
    $allUsers = OC_User::getUsers();
    foreach ($allUsers as $user) {
        if ($user != $self) {
            $users[] = "<option value='" . $user . "'>" . $user . "</option>";
        }
    }
} else {
    $userGroups = OC_Group::getUserGroups($self);
    foreach ($userGroups as $group) {
        $groupUsers = OC_Group::usersInGroup($group);
        $userCount = 0;
        foreach ($groupUsers as $user) {
            if ($user != $self) {
                $users[] = "<option value='" . $user . "'>" . $user . "</option>";
                $userCount++;
            }
        }
        // Don't include the group if only the current user is a member of it
        if ($userCount > 0) {
            $groups[] = "<option value='" . $group . "(group)'>" . $group . " (group) </option>";
        }
    }
    $users = array_unique($users);
}
$users[] = "</optgroup>";
开发者ID:noci2012,项目名称:owncloud,代码行数:31,代码来源:userautocomplete.php

示例13: getUsersAndGroups

 /**
  * Generate a string to be used for searching for uid_shared_with that handles both users and groups
  * @param $uid (Optional) The uid to get the user groups for, a gid to get the users in a group, or if not set the current user
  * @return An IN operator as a string
  */
 private static function getUsersAndGroups($uid = null)
 {
     $in = " IN(";
     if (isset($uid) && OC_Group::groupExists($uid)) {
         $users = OC_Group::usersInGroup($uid);
         foreach ($users as $user) {
             // Add a comma only if the the current element isn't the last
             if ($user !== end($users)) {
                 $in .= "'" . $user . "@" . $uid . "', ";
             } else {
                 $in .= "'" . $user . "@" . $uid . "'";
             }
         }
     } else {
         if (isset($uid)) {
             // TODO Check if this is necessary, only constructor needs it as IN. It would be better for other queries to just return =$uid
             $in .= "'" . $uid . "'";
             $groups = OC_Group::getUserGroups($uid);
             foreach ($groups as $group) {
                 $in .= ", '" . $uid . "@" . $group . "'";
             }
         } else {
             $uid = OC_User::getUser();
             $in .= "'" . $uid . "'";
             $groups = OC_Group::getUserGroups($uid);
             foreach ($groups as $group) {
                 $in .= ", '" . $uid . "@" . $group . "'";
             }
         }
     }
     $in .= ", '" . self::PUBLICLINK . "'";
     $in .= ")";
     return $in;
 }
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:39,代码来源:owncloud_apps_files_sharing_lib_share.php

示例14: postUnshare

 /**
  * unshare file/folder from a user with whom you shared the file before
  */
 public static function postUnshare($params)
 {
     if (\OCP\App::isEnabled('files_encryption') === false) {
         return true;
     }
     if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') {
         $view = new \OC\Files\View('/');
         $userId = \OCP\User::getUser();
         $util = new Util($view, $userId);
         $path = \OC\Files\Filesystem::getPath($params['fileSource']);
         // for group shares get a list of the group members
         if ($params['shareType'] === \OCP\Share::SHARE_TYPE_GROUP) {
             $userIds = \OC_Group::usersInGroup($params['shareWith']);
         } else {
             if ($params['shareType'] === \OCP\Share::SHARE_TYPE_LINK) {
                 $userIds = array($util->getPublicShareKeyId());
             } else {
                 $userIds = array($params['shareWith']);
             }
         }
         $mountManager = \OC\Files\Filesystem::getMountManager();
         $mount = $mountManager->find('/' . $userId . '/files' . $path);
         $mountPoint = $mount->getMountPoint();
         // if we unshare a folder we need a list of all (sub-)files
         if ($params['itemType'] === 'folder') {
             $allFiles = $util->getAllFiles($path, $mountPoint);
         } else {
             $allFiles = array($path);
         }
         foreach ($allFiles as $path) {
             // check if the user still has access to the file, otherwise delete share key
             $sharingUsers = $util->getSharingUsersArray(true, $path);
             // Unshare every user who no longer has access to the file
             $delUsers = array_diff($userIds, $sharingUsers);
             list($owner, $ownerPath) = $util->getUidAndFilename($path);
             // delete share key
             Keymanager::delShareKey($view, $delUsers, $ownerPath, $owner);
         }
     }
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:43,代码来源:hooks.php

示例15: str_replace

     $token = OC_Share::getTokenFromSource($path);
     if ($path == $source) {
         $item['privateLink'] = $token;
     } else {
         // If in parent folder, include a path parameter to get direct access to file
         $item['privateLink'] = $token . '&path=' . str_replace('%2F', '/', str_replace('+', '%20', urlencode(substr($source, strlen($path)))));
     }
 } else {
     // Check if uid_shared_with is a group
     if (($pos = strpos($uid_shared_with, '@')) !== false) {
         $gid = substr($uid_shared_with, $pos + 1);
         // Include users in the group so the users can be removed from the list of people to share with
         if ($path == $source) {
             $group = array(array('gid' => $gid, 'permissions' => $rows[$i]['permissions'], 'users' => OC_Group::usersInGroup($gid), 'parentFolder' => false));
         } else {
             $group = array(array('gid' => $gid, 'permissions' => $rows[$i]['permissions'], 'users' => OC_Group::usersInGroup($gid), 'parentFolder' => basename($path)));
         }
         if (!isset($item['groups'])) {
             $item['groups'] = $group;
         } else {
             if (is_array($item['groups'])) {
                 $gidExists = false;
                 $currentGroups = $item['groups'];
                 // Check if the group is already included
                 foreach ($currentGroups as $g) {
                     if ($g['gid'] == $gid) {
                         $gidExists = true;
                     }
                 }
                 if (!$gidExists) {
                     $item['groups'] = array_merge($item['groups'], $group);
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:31,代码来源:getitem.php


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