Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/jsxc.nextcloud.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobia De Koninck <tobia@ledfan.be>2017-10-01 11:03:44 +0300
committerTobia De Koninck <tobia@ledfan.be>2018-02-08 16:19:49 +0300
commit6ffad0a7a6bdca3495c341fad082c6adf245e9b1 (patch)
tree98f3b3c7a2e6bcc2fd1c1ef12b7097681cca251f
parentb65a863c4e09a3234534648bda49ed75f1f8e726 (diff)
Add missing Travis script + run cs-fixer + fix occ compliant
-rw-r--r--appinfo/application.php2
-rw-r--r--lib/ContactsStoreUserProvider.php31
-rw-r--r--lib/IUserProvider.php6
-rw-r--r--lib/User.php22
-rw-r--r--lib/UserManagerUserProvider.php31
-rw-r--r--lib/hooks.php1
-rw-r--r--lib/rosterpush.php5
-rw-r--r--tests/integration/db/PresenceMapperTest.php8
-rwxr-xr-xtests/travis/install-nc-contactsstore_public_api.sh17
9 files changed, 78 insertions, 45 deletions
diff --git a/appinfo/application.php b/appinfo/application.php
index 7bc5336..fb55c25 100644
--- a/appinfo/application.php
+++ b/appinfo/application.php
@@ -244,7 +244,7 @@ class Application extends App {
$container->registerService('UserProvider', function(IContainer $c) {
$version = \OCP\Util::getVersion();
- if ($version[0] == 13) {
+ if ($version[0] === 13) {
return new ContactsStoreUserProvider(
$c->query('OCP\Contacts\ContactsMenu\IContactsStore'),
$c->query('ServerContainer')->getUserSession(),
diff --git a/lib/ContactsStoreUserProvider.php b/lib/ContactsStoreUserProvider.php
index a5c8063..6f06d4c 100644
--- a/lib/ContactsStoreUserProvider.php
+++ b/lib/ContactsStoreUserProvider.php
@@ -5,7 +5,8 @@ namespace OCA\OJSXC;
use OCP\IUserManager;
use OCP\IUserSession;
-class ContactsStoreUserProvider implements IUserProvider {
+class ContactsStoreUserProvider implements IUserProvider
+{
/**
* @var \OCP\Contacts\ContactsMenu\IContactsStore
@@ -27,13 +28,15 @@ class ContactsStoreUserProvider implements IUserProvider {
*/
private $userManager;
- public function __construct($contactsStore, IUserSession $userSession, IUserManager $userManager) {
+ public function __construct($contactsStore, IUserSession $userSession, IUserManager $userManager)
+ {
$this->contactsStore = $contactsStore;
$this->userSession = $userSession;
$this->userManager = $userManager;
}
- public function getAllUsers() {
+ public function getAllUsers()
+ {
if (is_null(self::$cache)) {
$result = [];
$contacts = $this->contactsStore->getContacts($this->userSession->getUser(), '');
@@ -46,22 +49,25 @@ class ContactsStoreUserProvider implements IUserProvider {
}
return self::$cache;
-
}
- public function hasUser(User $user) {
+ public function hasUser(User $user)
+ {
return !is_null($this->contactsStore->findOne($this->userSession->getUser(), 0, $user->getUid()));
}
- public function hasUserByUID($uid) {
+ public function hasUserByUID($uid)
+ {
return !is_null($this->contactsStore->findOne($this->userSession->getUser(), 0, $uid));
}
- public function getAllUsersForUser(User $user) {
+ public function getAllUsersForUser(User $user)
+ {
return $this->getAllUsersForUserByUID($user->getUid());
}
- public function getAllUsersForUserByUID($uid) {
+ public function getAllUsersForUserByUID($uid)
+ {
$result = [];
$contacts = $this->contactsStore->getContacts($this->userManager->get($uid), '');
foreach ($contacts as $contact) {
@@ -72,12 +78,13 @@ class ContactsStoreUserProvider implements IUserProvider {
return $result;
}
- public function hasUserForUser(User $user1, User $user2) {
+ public function hasUserForUser(User $user1, User $user2)
+ {
return !is_null($this->contactsStore->findOne($this->userManager->get($user1->getUid()), 0, $user2->getUid()));
}
- public function hasUserForUserByUID($uid1, $uid2) {
+ public function hasUserForUserByUID($uid1, $uid2)
+ {
return !is_null($this->contactsStore->findOne($this->userManager->get($uid1), 0, $uid2));
}
-
-} \ No newline at end of file
+}
diff --git a/lib/IUserProvider.php b/lib/IUserProvider.php
index 5568aaa..67450ec 100644
--- a/lib/IUserProvider.php
+++ b/lib/IUserProvider.php
@@ -3,7 +3,8 @@
namespace OCA\OJSXC;
-interface IUserProvider {
+interface IUserProvider
+{
/**
* @brief Search all users for which the current users has access to.
@@ -54,5 +55,4 @@ interface IUserProvider {
* @return bool
*/
public function hasUserForUserByUID($uid1, $uid2);
-
-} \ No newline at end of file
+}
diff --git a/lib/User.php b/lib/User.php
index a258d22..9c4a4f2 100644
--- a/lib/User.php
+++ b/lib/User.php
@@ -4,7 +4,8 @@ namespace OCA\OJSXC;
use OCP\IUser;
-class User {
+class User
+{
/**
* @var string
@@ -27,7 +28,8 @@ class User {
* @param string $uid UID of the user
* @param string $fullName Fullname of the user
*/
- public function __construct($uid, $fullName, $origin) {
+ public function __construct($uid, $fullName, $origin)
+ {
$this->uid = $uid;
$this->fullName = $fullName;
$this->origin = $origin;
@@ -36,30 +38,32 @@ class User {
/**
* @return string
*/
- public function getUid() {
+ public function getUid()
+ {
return $this->uid;
}
/**
* @param string $uid
*/
- public function setUid($uid) {
+ public function setUid($uid)
+ {
$this->uid = $uid;
}
/**
* @return string
*/
- public function getFullName() {
+ public function getFullName()
+ {
return $this->fullName;
}
/**
* @param string $fullName
*/
- public function setFullName($fullName) {
+ public function setFullName($fullName)
+ {
$this->fullName = $fullName;
}
-
-
-} \ No newline at end of file
+}
diff --git a/lib/UserManagerUserProvider.php b/lib/UserManagerUserProvider.php
index 02b9dcd..d1d4b6c 100644
--- a/lib/UserManagerUserProvider.php
+++ b/lib/UserManagerUserProvider.php
@@ -4,7 +4,8 @@ namespace OCA\OJSXC;
use OCP\IUserManager;
-class UserManagerUserProvider implements IUserProvider {
+class UserManagerUserProvider implements IUserProvider
+{
/**
* @var IUserManager
@@ -16,11 +17,13 @@ class UserManagerUserProvider implements IUserProvider {
*/
private static $cache = null;
- public function __construct(IUserManager $userManager) {
+ public function __construct(IUserManager $userManager)
+ {
$this->userManager = $userManager;
}
- public function getAllUsers() {
+ public function getAllUsers()
+ {
if (is_null(self::$cache)) {
$result = [];
foreach ($this->userManager->search('') as $user) {
@@ -32,33 +35,37 @@ class UserManagerUserProvider implements IUserProvider {
return self::$cache;
}
- public function hasUser(User $user) {
+ public function hasUser(User $user)
+ {
return !is_null($this->userManager->get($user->getUid()));
-
}
- public function hasUserByUID($uid) {
+ public function hasUserByUID($uid)
+ {
return !is_null($this->userManager->get($uid));
}
- public function getAllUsersForUser(User $user) {
+ public function getAllUsersForUser(User $user)
+ {
// since we don't have access to the ContactsStore, we don't apply the enhancement privacy rules.
return $this->getAllUsers();
}
- public function getAllUsersForUserByUID($uid) {
+ public function getAllUsersForUserByUID($uid)
+ {
// since we don't have access to the ContactsStore, we don't apply the enhancement privacy rules.
return $this->getAllUsers();
}
- public function hasUserForUser(User $user1, User $user2) {
+ public function hasUserForUser(User $user1, User $user2)
+ {
// since we don't have access to the ContactsStore, we don't apply the enhancement privacy rules.
$this->hasUser($user2);
}
- public function hasUserForUserByUID($uid1, $uid2) {
+ public function hasUserForUserByUID($uid1, $uid2)
+ {
// since we don't have access to the ContactsStore, we don't apply the enhancement privacy rules.
$this->hasUserByUID($uid2);
}
-
-} \ No newline at end of file
+}
diff --git a/lib/hooks.php b/lib/hooks.php
index ad58d4c..09dde69 100644
--- a/lib/hooks.php
+++ b/lib/hooks.php
@@ -138,5 +138,4 @@ class Hooks
{
$this->rosterPush->removeRosterItemForUsersInGroup($group, $user->getUID());
}
-
}
diff --git a/lib/rosterpush.php b/lib/rosterpush.php
index 29ebed6..6a591f1 100644
--- a/lib/rosterpush.php
+++ b/lib/rosterpush.php
@@ -160,7 +160,8 @@ class RosterPush
return $stats;
}
- public function removeRosterItemForUsersInGroup(IGroup $group, $userId) {
+ public function removeRosterItemForUsersInGroup(IGroup $group, $userId)
+ {
$iq = new IQRosterPush();
$iq->setJid($userId);
$iq->setSubscription('remove');
@@ -173,7 +174,5 @@ class RosterPush
$this->iqRosterPushMapper->insert($iq);
}
}
-
}
-
}
diff --git a/tests/integration/db/PresenceMapperTest.php b/tests/integration/db/PresenceMapperTest.php
index b37ce7f..de905f7 100644
--- a/tests/integration/db/PresenceMapperTest.php
+++ b/tests/integration/db/PresenceMapperTest.php
@@ -46,18 +46,19 @@ class PresenceMapperTest extends MapperTestUtility
}
}
- protected function tearDown() {
+ protected function tearDown()
+ {
foreach (\OC::$server->getUserManager()->search('') as $user) {
$user->delete();
}
-
}
/**
* @before
* TODO explciclty call this function
*/
- public function setupContactsStoreAPI() {
+ public function setupContactsStoreAPI()
+ {
foreach (\OC::$server->getUserManager()->search('') as $user) {
$user->delete();
}
@@ -83,7 +84,6 @@ class PresenceMapperTest extends MapperTestUtility
\OC_User::setIncognitoMode(false);
\OC::$server->getDatabaseConnection()->executeQuery("DELETE FROM *PREFIX*ojsxc_stanzas");
-
}
/**
diff --git a/tests/travis/install-nc-contactsstore_public_api.sh b/tests/travis/install-nc-contactsstore_public_api.sh
new file mode 100755
index 0000000..4896935
--- /dev/null
+++ b/tests/travis/install-nc-contactsstore_public_api.sh
@@ -0,0 +1,17 @@
+#!/bin/bash -x
+# set up postgresql
+createuser -U travis -s oc_autotest
+# set up mysql
+mysql -e 'create database oc_autotest;'
+mysql -u root -e "CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY '';"
+mysql -u root -e "grant all on oc_autotest.* to 'oc_autotest'@'localhost';"
+# install nextcloud
+cd ..
+#ncdev setup core --dir owncloud --branch $BRANCH --no-history
+git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b $BRANCH nextcloud
+mv jsxc.nextcloud nextcloud/apps/ojsxc
+phpenv config-add nextcloud/apps/ojsxc/tests/travis/php.ini
+cd nextcloud
+./occ maintenance:install --database-name oc_autotest --database-user oc_autotest --database-pass --admin-user admin --admin-pass admin --database $DB
+./occ app:enable ojsxc
+cd apps/ojsxc