-
Notifications
You must be signed in to change notification settings - Fork 350
added VersionSubscriber and necessary node types and behaviors #3042
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
Conversation
5b8ea29
to
a691e8f
Compare
dae5da1
to
dc46dc6
Compare
9ae0de6
to
e00d978
Compare
e00d978
to
cb778ed
Compare
cb778ed
to
5ba1738
Compare
@chirimoya I am working on introducing the flag, what should be the default? I would go for |
@@ -776,6 +776,17 @@ public function postTriggerAction($uuid, Request $request) | |||
$this->getDocumentManager()->removeDraft($data, $language); | |||
$this->getDocumentManager()->flush(); | |||
break; | |||
case 'restore': |
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.
Should we somehow disable this action if versioning is disabled? I'd say we should, the question is how. Put all of the code in this case
in a if
, and let the code fall through, or throw the exception in this branch? As Unrecognized action
or something like versioning is disabled
?
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.
@chirimoya When thinking about it... Should we move that functionality to the VersionController
, and deactivate the version controller as a whole?
@@ -11,6 +11,11 @@ sulu_content.node.seo: | |||
parent: sulu_content.node | |||
resource: Sulu\Bundle\ContentBundle\Controller\SeoController | |||
|
|||
sulu_content.node.versions: |
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.
Should probably not be registered if versioning is disabled.
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.
Should be possible with custom route loaders.
@@ -259,6 +259,39 @@ define([ | |||
} | |||
]); | |||
|
|||
this.sandbox.start([ |
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.
Don't show if versioning is disabled.
<span class="name">...</span> (<span class="date">...</span>) | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div id="versions"> |
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.
Don't output if versioning is disabled.
|
||
<service id="sulu_document_manager.suscriber.behavior.version" |
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.
Don't register when versioning is disabled.
@@ -49,6 +49,7 @@ public function getDeclaredSupertypeNames() | |||
{ | |||
return [ | |||
'sulu:base', | |||
'mix:versionable', |
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.
Don't include mixin directly in NodeType, otherwise it won't be usable in PHPCR implementations without versioning.
ad4e4e2
to
0d4db89
Compare
* | ||
* @return \Symfony\Component\HttpFoundation\Response | ||
*/ | ||
public function postAction(Request $request, $uuid, $version) |
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.
The cool thing here is that we don't need the @Post
annotation as we have in the NodeController
the $version
parameter will also be added to the route from the method signature.
The bad thing is that the security is not working correctly then, since it is recognizing the POST
as create, which means that every who is allowed to add a page can also restore it...
That's probably part of a bigger issue, we've got several ways to handle this.
- Find a different way to distinguish between
add
andcreate
in security (would have to think about that, maybe if the last part excluding the query string is number or uuid?) - Handle security without the fancy helpers Sulu gives us.
- Rename that action to
postTrigger
action as we are used to it, and add a@Post
annotation. The drawback is that we have to include the parent route in the annotation:/nodes/{uuid}/versions/{version}
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.
use postAction
and validate query parameter action
or url last segment is placeholder
@@ -18,6 +18,10 @@ public function registerContainerConfiguration(LoaderInterface $loader) | |||
{ | |||
parent::registerContainerConfiguration($loader); | |||
|
|||
if (getenv('SYMFONY__PHPCR__TRANSPORT') === 'jackrabbit') { |
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.
I don't have a better (and fastly implementable) idea how to solve this. It's about enabling versioning only for jackrabbit... A solution might be to add another environment variable. Would allow us to also test jackrabbit without versioning. Then we would have another build more, and the tests are taking longer, ... I think I would leave it like that.
/** | ||
* Responsible for integrating the security part of Sulu to the DocumentManager. | ||
*/ | ||
class SecuritySubscriber implements EventSubscriberInterface |
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.
This subscriber makes detecting the user more reusable. It's always set as an option, so that it can be reused in all the different events.
08270b4
to
81d7d6c
Compare
a13d0e6
to
cf210af
Compare
@danrot ready to merge? |
@chirimoya yes 😃 |
What's in this PR?
This PR adds versioning support for pages.
TODO
mix:versionable
mixin fromsulu:page