forked from owncloud/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove static methods and add unit tests
- Loading branch information
1 parent
8a3f853
commit 4d68e05
Showing
13 changed files
with
495 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# test coverage | ||
tests/clover.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,34 @@ | ||
<?php | ||
|
||
/** | ||
* ownCloud - firstrunwizard application | ||
* | ||
* @author Frank Karlitschek | ||
* @copyright 2012 Frank Karlitschek frank@owncloud.org | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public | ||
* License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
* ownCloud - firstrunwizard application | ||
* | ||
* @author Frank Karlitschek | ||
* @copyright 2012 Frank Karlitschek frank@owncloud.org | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public | ||
* License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
namespace OCA\FirstRunWizard; | ||
|
||
OCP\JSON::checkLoggedIn(); | ||
OCP\JSON::checkAppEnabled('firstrunwizard'); | ||
OCP\JSON::callCheck(); | ||
use OCP\JSON; | ||
|
||
\OCA_FirstRunWizard\Config::disable(); | ||
JSON::checkLoggedIn(); | ||
JSON::checkAppEnabled('firstrunwizard'); | ||
JSON::callCheck(); | ||
|
||
$config = \OC::$server->getConfig(); | ||
$userSession = \OC::$server->getUserSession(); | ||
$firstRunConfig = new Config($config, $userSession); | ||
|
||
$firstRunConfig->disable(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,34 @@ | ||
<?php | ||
|
||
/** | ||
* ownCloud - firstrunwizard application | ||
* | ||
* @author Frank Karlitschek | ||
* @copyright 2012 Frank Karlitschek frank@owncloud.org | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public | ||
* License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
* ownCloud - firstrunwizard application | ||
* | ||
* @author Frank Karlitschek | ||
* @copyright 2012 Frank Karlitschek frank@owncloud.org | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public | ||
* License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
namespace OCA\FirstRunWizard; | ||
|
||
OCP\JSON::checkLoggedIn(); | ||
OCP\JSON::checkAppEnabled('firstrunwizard'); | ||
OCP\JSON::callCheck(); | ||
use OCP\JSON; | ||
|
||
\OCA_FirstRunWizard\Config::enable(); | ||
JSON::checkLoggedIn(); | ||
JSON::checkAppEnabled('firstrunwizard'); | ||
JSON::callCheck(); | ||
|
||
$config = \OC::$server->getConfig(); | ||
$userSession = \OC::$server->getUserSession(); | ||
$firstRunConfig = new Config($config, $userSession); | ||
|
||
$firstRunConfig->enable(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
|
||
/** | ||
* ownCloud - firstrunwizard App | ||
* | ||
* @author Frank Karlitschek | ||
* @copyright 2012 Frank Karlitschek frank@owncloud.org | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public | ||
* License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
namespace OCA\FirstRunWizard; | ||
|
||
use OCP\IConfig; | ||
use OCP\IUserSession; | ||
|
||
class Config { | ||
|
||
protected $config; | ||
|
||
protected $userSession; | ||
|
||
/** | ||
* @param IConfig $config | ||
* @param IUserSession $userSession | ||
*/ | ||
public function __construct(IConfig $config, IUserSession $userSession) { | ||
$this->config = $config; | ||
$this->userSession = $userSession; | ||
} | ||
|
||
/** | ||
* @brief Disable the FirstRunWizard | ||
*/ | ||
public function enable() { | ||
$user = $this->userSession->getUser(); | ||
if ($user) { | ||
$this->config->setUserValue($user->getUID(), 'firstrunwizard', 'show', 1); | ||
} | ||
} | ||
|
||
/** | ||
* @brief Enable the FirstRunWizard | ||
*/ | ||
public function disable() { | ||
$user = $this->userSession->getUser(); | ||
if ($user) { | ||
$this->config->setUserValue($user->getUID(), 'firstrunwizard', 'show', 0); | ||
} | ||
} | ||
|
||
/** | ||
* @brief Check if the FirstRunWizard is enabled or not | ||
* @return bool | ||
*/ | ||
public function isEnabled() { | ||
$user = $this->userSession->getUser(); | ||
if ($user) { | ||
$conf = $this->config->getUserValue($user->getUID(), 'firstrunwizard', 'show', 1); | ||
return (intval($conf) === 1); | ||
} else { | ||
return false; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.