Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
478af1a0
Commit
478af1a0
authored
Oct 20, 2016
by
Vincent Petry
Committed by
GitHub
Oct 20, 2016
Browse files
Merge pull request #26382 from owncloud/move-more-ocs
Move /cloud/user and /cloud/capabilities over to AppFramework
parents
3f9d9d78
394ba7dd
Changes
8
Hide whitespace changes
Inline
Side-by-side
core/Application.php
View file @
478af1a0
...
...
@@ -30,6 +30,7 @@ namespace OC\Core;
use
OC\AppFramework\Utility\SimpleContainer
;
use
OC\AppFramework\Utility\TimeFactory
;
use
OC\Core\Controller\AvatarController
;
use
OC\Core\Controller\CloudController
;
use
OC\Core\Controller\LoginController
;
use
OC\Core\Controller\LostController
;
use
OC\Core\Controller\OccController
;
...
...
@@ -126,6 +127,12 @@ class Application extends App {
$c
->
query
(
'SecureRandom'
)
);
});
$container
->
registerService
(
'CloudController'
,
function
(
SimpleContainer
$c
)
{
return
new
CloudController
(
$c
->
query
(
'AppName'
),
$c
->
query
(
'Request'
)
);
});
/**
* Core class wrappers
...
...
lib/private/OCS/Cloud
.php
→
core/Controller/CloudController
.php
View file @
478af1a0
...
...
@@ -22,11 +22,24 @@
*
*/
namespace
OC\
OCS
;
namespace
OC\
Core\Controller
;
class
Cloud
{
use
OCP\AppFramework\OCSController
;
use
OCP\IRequest
;
public
static
function
getCapabilities
()
{
class
CloudController
extends
OCSController
{
public
function
__construct
(
$appName
,
IRequest
$request
)
{
parent
::
__construct
(
$appName
,
$request
);
}
/**
* @NoAdminRequired
* @NoCSRFRequired
*
* @return array
*/
public
function
getCapabilities
()
{
$result
=
[];
list
(
$major
,
$minor
,
$micro
)
=
\
OCP\Util
::
getVersion
();
$result
[
'version'
]
=
[
...
...
@@ -39,16 +52,22 @@ class Cloud {
$result
[
'capabilities'
]
=
\
OC
::
$server
->
getCapabilitiesManager
()
->
getCapabilities
();
return
new
Result
(
$result
)
;
return
[
'data'
=>
$result
]
;
}
public
static
function
getCurrentUser
()
{
/**
* @NoAdminRequired
* @NoCSRFRequired
*
* @return array
*/
public
function
getCurrentUser
()
{
$userObject
=
\
OC
::
$server
->
getUserManager
()
->
get
(
\
OC_User
::
getUser
());
$data
=
[
'id'
=>
$userObject
->
getUID
(),
'display-name'
=>
$userObject
->
getDisplayName
(),
'email'
=>
$userObject
->
getEMailAddress
(),
];
return
new
Result
(
$data
)
;
return
[
'data'
=>
$data
]
;
}
}
core/routes.php
View file @
478af1a0
...
...
@@ -53,6 +53,10 @@ $application->registerRoutes($this, [
[
'name'
=>
'TwoFactorChallenge#showChallenge'
,
'url'
=>
'/login/challenge/{challengeProviderId}'
,
'verb'
=>
'GET'
],
[
'name'
=>
'TwoFactorChallenge#solveChallenge'
,
'url'
=>
'/login/challenge/{challengeProviderId}'
,
'verb'
=>
'POST'
],
],
'ocs'
=>
[
[
'name'
=>
'Cloud#getCapabilities'
,
'url'
=>
'/cloud/capabilities'
,
'verb'
=>
'GET'
],
[
'name'
=>
'Cloud#getCurrentUser'
,
'url'
=>
'/cloud/user'
,
'verb'
=>
'GET'
],
]
]);
// Post installation check
...
...
lib/private/Route/Router.php
View file @
478af1a0
...
...
@@ -164,6 +164,11 @@ class Router implements IRouter {
$this
->
useCollection
(
'root'
);
require_once
__DIR__
.
'/../../../settings/routes.php'
;
require_once
__DIR__
.
'/../../../core/routes.php'
;
// Also add the OCS collection
$collection
=
$this
->
getCollection
(
'root.ocs'
);
$collection
->
addPrefix
(
'/ocsapp'
);
$this
->
root
->
addCollection
(
$collection
);
}
if
(
$this
->
loaded
)
{
// include ocs routes, must be loaded last for /ocs prefix
...
...
lib/private/legacy/app.php
View file @
478af1a0
...
...
@@ -186,7 +186,7 @@ class OC_App {
try
{
// encapsulated here to avoid variable scope conflicts
require_once
$app
.
'/appinfo/app.php'
;
}
catch
(
E
rror
$ex
)
{
}
catch
(
E
xception
$ex
)
{
\
OC
::
$server
->
getLogger
()
->
logException
(
$ex
);
$blacklist
=
\
OC
::
$server
->
getAppManager
()
->
getAlwaysEnabledApps
();
if
(
!
in_array
(
$app
,
$blacklist
))
{
...
...
lib/private/legacy/ocs/cloud.php
deleted
100644 → 0
View file @
3f9d9d78
<?php
/**
* @author Roeland Jago Douma <rullzer@owncloud.com>
* @author Thomas Müller <thomas.mueller@tmit.eu>
*
* @copyright Copyright (c) 2016, ownCloud GmbH.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program 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, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
/**
* @deprecated Since 9.1.0 use \OC\OCS\Cloud
*/
class
OC_OCS_Cloud
extends
\
OC\OCS\Cloud
{
}
ocs/routes.php
View file @
478af1a0
...
...
@@ -81,21 +81,6 @@ API::register(
'core'
,
API
::
USER_AUTH
);
// cloud
API
::
register
(
'get'
,
'/cloud/capabilities'
,
[
'OC_OCS_Cloud'
,
'getCapabilities'
],
'core'
,
API
::
USER_AUTH
);
API
::
register
(
'get'
,
'/cloud/user'
,
[
'OC_OCS_Cloud'
,
'getCurrentUser'
],
'core'
,
API
::
USER_AUTH
);
// Server-to-Server Sharing
if
(
\
OC
::
$server
->
getAppManager
()
->
isEnabledForUser
(
'files_sharing'
))
{
...
...
ocs/v1.php
View file @
478af1a0
...
...
@@ -76,6 +76,7 @@ try {
if
(
!
\
OC
::
$server
->
getUserSession
()
->
isLoggedIn
())
{
OC
::
handleLogin
(
\
OC
::
$server
->
getRequest
());
}
OC
::
$server
->
getRouter
()
->
match
(
'/ocsapp'
.
\
OC
::
$server
->
getRequest
()
->
getRawPathInfo
());
}
catch
(
LoginException
$e
)
{
OC_API
::
respond
(
new
Result
(
null
,
\
OCP\API
::
RESPOND_UNAUTHORISED
,
'Unauthorised'
),
OC_API
::
requestedFormat
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment