Skip to content
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

SAK-50945 assignment cc+archive should not export group data and turn off assign to group #13279

Merged
merged 2 commits into from
Feb 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -828,19 +828,14 @@ private static void patchArchive(CCConfig ccConfig, String path) {
if ( changed) Xml.writeDocument(doc, contentXml);
}

// Remove roles / groups / providers data from site.xml
// Remove roles / providers data from site.xml
String siteXml = path + "site.xml";
doc = Xml.readDocument(siteXml);
if ( doc != null ) {
boolean changed = false;
nodeList = doc.getElementsByTagName("roles");
while (nodeList.getLength() > 0) {
Node node = nodeList.item(0);
node.getParentNode().removeChild(node);
changed = true;
}

nodeList = doc.getElementsByTagName("groups");
// Remove ability tags from roles as they include user ids
nodeList = doc.getElementsByTagName("ability");
while (nodeList.getLength() > 0) {
Node node = nodeList.item(0);
node.getParentNode().removeChild(node);
Expand All @@ -853,9 +848,27 @@ private static void patchArchive(CCConfig ccConfig, String path) {
node.getParentNode().removeChild(node);
changed = true;
}
if ( changed) Xml.writeDocument(doc, siteXml);
if (changed) Xml.writeDocument(doc, siteXml);
}

// Patch assignments.xml- remove any submissions because it is user data
String assignmentXml = path + "assignment.xml";
doc = Xml.readDocument(assignmentXml);
if (doc != null) {
boolean changed = false;

NodeList subNodes = doc.getElementsByTagName("submissions");
for (int i = 0; i < subNodes.getLength(); i++) {
Node subNode = subNodes.item(i);
NodeList children = subNode.getChildNodes();
for (int j = 0; j < children.getLength(); j++) {
Node child = children.item(j);
subNode.removeChild(child);
changed = true;
}
}
if (changed) Xml.writeDocument(doc, assignmentXml);
}
}

private static void addAllArchive(ZipPrintStream out, CCConfig ccConfig, File dir, String path) throws IOException {
Expand Down
Loading