... |
... |
@@ -3,7 +3,7 @@ |
3 |
3 |
|
4 |
4 |
// References |
5 |
5 |
def groupDocRef = new DocumentReference("xwiki", "XWiki", "XWikiAllGroup") |
6 |
|
-def groupClassName = "XWiki.XWikiGroups" as String // Force string type! |
|
6 |
+def groupClassName = "XWiki.XWikiGroups" // ⚠️ Must be a STRING |
7 |
7 |
|
8 |
8 |
// Load or create the group page |
9 |
9 |
def groupDocAPI = xwiki.getDocument(groupDocRef) |
... |
... |
@@ -24,13 +24,13 @@ |
24 |
24 |
} |
25 |
25 |
|
26 |
26 |
if (!alreadyMember) { |
27 |
|
- def obj = groupDoc.newXObject(groupClassName) |
|
27 |
+ def obj = groupDoc.newXObject(groupClassName) // ✅ String only |
28 |
28 |
obj.setStringValue("member", userDocName) |
29 |
29 |
added << userDocName |
30 |
30 |
} |
31 |
31 |
} |
32 |
32 |
|
33 |
|
-// Save if needed |
|
33 |
+// Save the document |
34 |
34 |
if (added) { |
35 |
35 |
def wrappedDoc = xwiki.getDocument(groupDoc.documentReference) |
36 |
36 |
xwiki.saveDocument(wrappedDoc, "Added users to group: ${added.join(', ')}") |