-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Capabilities manager #15093
Capabilities manager #15093
Conversation
Capabilitie -> Capability (found in multiple places) |
Thanks, fixed. |
/** | ||
* Register capabilities | ||
*/ | ||
$server->getCapabilitiesManager()->registerCapability(function() use ($container) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this block for ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, got it... I mixed up CapabilitiesController and CapabilitiesManager.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To register the capabilities with the manager. Else how would it know where to look?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the use, you dont use it anymore
Great stuff! You might want to adapt the other apps next (files_sharing, files_versions, files_trashbin) to also use this. |
@PVince81 thanks. Yeah those are on my list to adapt. But wanted feedback first. I also plan to print a warning to the log if somebody tries to register a capabilities route instead of the capabilities manager. |
Please rebase. Is this ready for test/review ? If yes, please remove the WIP 😄 |
I guess this is not yet compatible with the old OCS URLs, isn't it ? |
(I haven't tested yet) |
); | ||
|
||
|
||
$result['capabilities'] = array_merge_recursive($result['capabilities'], \OC::$server->getCapabilitiesManager()->getCapabilities()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PVince81 that is actually what happens here. since we do yet have OCS routes in the appframework.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move the existing capa... also in a Class:
'pollinterval' => OC_Config::getValue('pollinterval', 60)
so people will stop hard coding it
|
Jenkins is happy #15278 |
cc @LukasReschke @schiesbn |
@nickvergessen thanks! Fixed your comments. |
if ($c instanceof ICapability) { | ||
$capabilities = array_replace_recursive($capabilities, $c->getCapabilities()); | ||
} else { | ||
throw new NotACapabilityException(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just throw \InvalidArgumentException
http://php.net/manual/de/class.invalidargumentexception.php
throw new \InvalidArgumentException('The given Capability does not implement the ICapability interface');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes more sense. thanks.
Fixed
Hopefully the final jenkins PR at #15093 |
That bot isn't easy to satisfy, is it ;-) |
Jenkins is happy #15093 |
Call for (final) reviews: @Raydiation @PVince81 @DeepDiver1975 @LukasReschke @MorrisJobke @nickvergessen |
* This should allow the capabilities to be intergrated into the appframework * Unit tests * Throw exception if closure does not return ICapability instance
* Files * Files_Sharing * Files_Trashbin * Files_Versions
A new inspection was created. |
@owncloud-bot retest this please |
Looks good to me 👍 |
@Raydiation can I assume your 👍 is still valid? |
yes |
Implementation of proposal in #14805
The first commit adds the capabilities manager. There now is a capabilities manager where apps can register them self. The capabilities are then all collected in 1 place by iterating over all the apps that have registered a capabilities manager.
The second commit moves the files app to the shiny new capabilities manager.
Comments and suggestions are very welcome. As this would help to get #13964 in. Which would greatly improve the client UX.
Unit tests will of course follow once I have addressed the comments.
CC: @DeepDiver1975 @PVince81 @Raydiation @LukasReschke