/** * @brief Get a list of all users * @param string $search * @param int $limit * @param int $offset * @returns array with all uids * * Get a list of all users. */ public function getUsers($search = '', $limit = NULL, $offset = 0) { $result = array(); try { $users = OMVRpc::exec("UserMgmt", "getUserList", array("start" => intval($offset), "limit" => !is_null($limit) ? intval($limit) : NULL, "sortfield" => !empty($search) ? $search : NULL, "sortdir" => NULL), $this->context, OMV_RPC_MODE_REMOTE); foreach ($users['data'] as $userk => $userv) { $result[] = $userv['name']; } } catch (Exception $e) { OC_Log::write("OC_User_OpenMediaVault", sprintf("Failed to get users (code=%d, message=%s)", $e->getCode(), $e->getMessage()), OC_Log::ERROR); } return $result; }
/** * @brief get a list of all users in a group * @param string $gid * @param string $search * @param int $limit * @param int $offset * @return array with user ids */ public function usersInGroup($gid, $search = '', $limit = NULL, $offset = 0) { $users = array(); try { $group = OMVRpc::exec("UserMgmt", "getGroup", array("name" => strtolower($uid)), $this->context, OMV_RPC_MODE_REMOTE); $users = $group['members']; } catch (Exception $e) { OC_Log::write("OC_Group_OpenMediaVault", sprintf("Failed to " . "get users in group '%s' (code=%d, message=%s)", $gid, $e->getCode(), $e->getMessage()), OC_Log::ERROR); } return $users; }