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
c44e3b05
Commit
c44e3b05
authored
Nov 15, 2014
by
Morris Jobke
Browse files
Merge pull request #12189 from owncloud/checkIfAppIsEnabled
Check if app is enabled for user
parents
580d27ee
cd592503
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/private/appframework/middleware/security/securitymiddleware.php
View file @
c44e3b05
...
...
@@ -34,6 +34,7 @@ use OCP\INavigationManager;
use
OCP\IURLGenerator
;
use
OCP\IRequest
;
use
OCP\ILogger
;
use
OCP\AppFramework\Controller
;
/**
...
...
@@ -116,6 +117,16 @@ class SecurityMiddleware extends Middleware {
}
}
/**
* FIXME: Use DI once available
* Checks if app is enabled (also inclues a check whether user is allowed to access the resource)
* The getAppPath() check is here since components such as settings also use the AppFramework and
* therefore won't pass this check.
*/
if
(
\
OC_App
::
getAppPath
(
$this
->
appName
)
!==
false
&&
!
\
OC_App
::
isEnabled
(
$this
->
appName
))
{
throw
new
SecurityException
(
'App is not enabled'
,
Http
::
STATUS_PRECONDITION_FAILED
);
}
}
...
...
tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php
View file @
c44e3b05
...
...
@@ -77,7 +77,7 @@ class SecurityMiddlewareTest extends \PHPUnit_Framework_TestCase {
$this
->
navigationManager
,
$this
->
urlGenerator
,
$this
->
logger
,
'
t
es
t
'
,
'
fil
es'
,
$isLoggedIn
,
$isAdminUser
);
...
...
@@ -91,7 +91,7 @@ class SecurityMiddlewareTest extends \PHPUnit_Framework_TestCase {
public
function
testSetNavigationEntry
(){
$this
->
navigationManager
->
expects
(
$this
->
once
())
->
method
(
'setActiveEntry'
)
->
with
(
$this
->
equalTo
(
'
t
es
t
'
));
->
with
(
$this
->
equalTo
(
'
fil
es'
));
$this
->
reader
->
reflect
(
__CLASS__
,
__FUNCTION__
);
$this
->
middleware
->
beforeController
(
__CLASS__
,
__FUNCTION__
);
...
...
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