Created
November 28, 2013 12:46
-
-
Save pellaeon/7691325 to your computer and use it in GitHub Desktop.
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
namespace OC\Core\Command; | |
use Symfony\Component\Console\Command\Command; | |
use Symfony\Component\Console\Input\InputArgument; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Input\InputOption; | |
use Symfony\Component\Console\Output\OutputInterface; | |
class Auth extends Command { | |
protected function configure() { | |
$this | |
->setName('auth') | |
->setDescription('Check credentials in CLI') | |
->addArgument('username', InputArgument::REQUIRED, 'Username') | |
->addArgument('password', InputArgument::REQUIRED, 'Password') | |
; | |
} | |
protected function execute(InputInterface $input, OutputInterface $output) { | |
$uid = \OC_User::checkPassword($input->getArgument('username'), $input->getArgument('password')); | |
if ( $uid == false ) { | |
echo "auth_ok:-1\n"; | |
} else { | |
echo "auth_ok:1\n"; | |
echo "dir:".\OC_User::getHome($uid)."\n"; | |
$quota = \OC_Util::getUserQuota($uid); | |
if ( $quota != \OC\Files\SPACE_UNLIMITED ) { | |
echo "user_quota_size:".$quota."\n"; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment