Details
-
Bug
-
Resolution: Fixed
-
Major
-
13.10.3
-
Unit
-
Unknown
-
N/A
-
N/A
-
Description
A guest user reference (of type GuestUserReference) is serialized as XWiki.XWikiGuest which is then resolved by default as a new DocumentUserReference containing a reference to XWiki.XWikiGuest: this is not consistent as it should be resolved back to a GuestUserReference.
Here's a snippet showing the bug:
{{groovy}} import org.xwiki.user.UserReference; import org.xwiki.user.UserReferenceResolver; import org.xwiki.user.UserReferenceSerializer; import org.xwiki.user.GuestUserReference; import org.xwiki.component.util.DefaultParameterizedType; import javax.inject.Inject; import javax.inject.Named; import org.xwiki.model.reference.DocumentReference; // Get UserReferenceResolver for the test def resolverType = new DefaultParameterizedType(null, UserReferenceResolver.class, String.class); def userReferenceResolver = services.component.getInstance(resolverType); // Get a UserReferenceSerializer def serializerType = new DefaultParameterizedType(null, UserReferenceSerializer.class, String.class); def userReferenceSerializer = services.component.getInstance(serializerType); def guestUser = GuestUserReference.INSTANCE; println "guest user reference: " + guestUser; def serializedGuest = userReferenceSerializer.serialize(guestUser); println "Serialized guest user reference: " + serializedGuest; // Resolved back the serialized guest user reference to UserReference def resolvedBackReference = userReferenceResolver.resolve(serializedGuest); println "Obtained user reference: " + resolvedBackReference; // Check if both references are equals def areReferenceEquals = guestUser.equals(resolvedBackReference); println "Obtained reference is equal to the original reference: " + areReferenceEquals; {{/groovy}}
Attachments
Issue Links
- blocks
-
CRAPP-64 Authors without edit rights should be able to edit title of CR
- Closed