Skip to content
Open
Show file tree
Hide file tree
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
21 changes: 17 additions & 4 deletions test-app/src/main/ml-config/security/roles/rest-evaluator.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
"role-name": "rest-evaluator",
"description": "REST writer who can eval, invoke, or set a dynamic databases",
"role": [
"rest-writer"
],
"role": ["rest-writer", "sparql-update-user"],
"privilege": [
{
"privilege-name": "xdmp-eval",
Expand Down Expand Up @@ -49,6 +47,21 @@
"privilege-name": "xdmp-get-session-field",
"action": "http://marklogic.com/xdmp/privileges/xdmp-get-session-field",
"kind": "execute"
},
{
"privilege-name": "xdmp-login",
"action": "http://marklogic.com/xdmp/privileges/xdmp-login",
"kind": "execute"
},
{
"privilege-name": "unprotected-collections",
"action": "http://marklogic.com/xdmp/privileges/unprotected-collections",
"kind": "execute"
},
{
"privilege-name": "xdmp-xslt-invoke",
"action": "http://marklogic.com/xdmp/privileges/xslt-invoke",
"kind": "execute"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"role-name": "rest-invoke-user",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This role name is surprising - I would assume that it grants invoke privileges. I would rename it to "login-role" or something self-documenting like that. You could then have multiple roles that require the login privilege inherit this role.

"description": "Role granting xdmp:login privilege needed for REST transform invocations with different-transaction isolation",
"privilege": [
{
"privilege-name": "xdmp-login",
"action": "http://marklogic.com/xdmp/privileges/xdmp-login",
"kind": "execute"
}
]
}
7 changes: 5 additions & 2 deletions test-app/src/main/ml-config/security/users/rest-admin.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"description": "rest-admin user",
"password": "x",
"role": [
"rest-admin"
"rest-admin",
"rest-evaluator",
"rest-extension-user",
"sparql-update-user"
]
}
}
6 changes: 2 additions & 4 deletions test-app/src/main/ml-config/security/users/rest-reader.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
"user-name": "rest-reader",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be useful to rename this - probably in a separate PR - given that it now refers to 3 things - a user, and then OOTB role and privilege. It's already confusing enough that there are OOTB roles and privileges that are both named rest-reader and rest-writer.

"description": "rest-reader user",
"password": "x",
"role": [
"rest-reader"
]
}
"role": ["rest-reader", "rest-extension-user", "rest-invoke-user"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
"user-name": "rest-temporal-writer",
"description": "rest-writer user with temporal privileges",
"password": "x",
"role": [
"rest-temporal-writer"
]
}
"role": ["rest-temporal-writer", "rest-extension-user"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"user-name": "rest-transform-user",
"role": ["rest-transform-internal", "rest-reader", "rest-invoke-user"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"role": [
"rest-writer",
"rest-evaluator",
"temporal-admin"
"temporal-admin",
"rest-extension-user"
]
}
6 changes: 3 additions & 3 deletions test-basic/documents-transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ describe('document transform', function(){
documents.length.should.equal(1);
documents[0].content.should.have.property('timestamp');
documents[0].content.should.have.property('userName');
documents[0].content.userName.should.eql('rest-writer');
documents[0].content.userName.should.eql('rest-transform-user'); // MLE-28684: transforms now run as rest-transform-user
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generally frown on this sort of comment - an assertion message would be far more useful. I think the main thing someone would be wondering is - hmm, why is this user expected? What is special about this user? A good assertion message would state "As of such and such markLogic version, a user now needs (fill in the blank) privilege in order to do such and such". The Jira ticket ID can be in version history too, it doesn't need to be in a comment or assertion message.

done();
})
.catch(done);
Expand All @@ -202,7 +202,7 @@ describe('document transform', function(){
documents.length.should.equal(1);
documents[0].content.should.have.property('timestamp');
documents[0].content.should.have.property('userName');
documents[0].content.userName.should.eql('rest-writer');
documents[0].content.userName.should.eql('rest-transform-user'); // MLE-28684: transforms now run as rest-transform-user
done();
})
.catch(done);
Expand All @@ -221,7 +221,7 @@ describe('document transform', function(){
documents.length.should.equal(1);
documents[0].content.should.have.property('timestamp');
documents[0].content.should.have.property('userName');
documents[0].content.userName.should.eql('rest-writer');
documents[0].content.userName.should.eql('rest-transform-user'); // MLE-28684: transforms now run as rest-transform-user
done();
})
.catch(done);
Expand Down
10 changes: 6 additions & 4 deletions test-complete/nodejs-dmsdk-readall-1.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2015-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
*/
* Copyright (c) 2015-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
*/
var fs = require('fs');
const path = require('path');

Expand Down Expand Up @@ -143,6 +143,7 @@ describe('readAll-tests-one', function () {
function (err, arr) {
if (err) {
done(err);
return;
}
arr.forEach(item => {
setTimeout(() => {
Expand All @@ -158,8 +159,8 @@ describe('readAll-tests-one', function () {
for (var c of resulContents) {
expect(verifyCurrentContents(c)).to.be.true;
}
done();
});
done();
});

it('readAll one document with batch options', function (done) {
Expand All @@ -173,15 +174,16 @@ describe('readAll-tests-one', function () {
function (err, arr) {
if (err) {
done(err);
return;
}
arr.forEach(item => {
setTimeout(() => {
var i = 0; i++;
}, 3000);
expect(item.uri).to.equal('dmsdk.txt');
});
done();
});
done();
});

//Verify no errors when readAll has no Uris to read
Expand Down
12 changes: 7 additions & 5 deletions test-complete/nodejs-transform-javascript.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
* Copyright (c) 2015-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
*/
var should = require('should');
var fs = require('fs');
Expand Down Expand Up @@ -73,9 +73,10 @@ describe('Transform test with javascript', function () {
result(function (response) {
//console.log(JSON.stringify(response, null, 4));
response[0].content.should.have.property('timestamp');
response[0].content.userName.should.equal('rest-reader');
response[0].content.userName.should.equal('rest-transform-user'); // MLE-28684: transforms now run as rest-transform-user
done();
}, done);
})
.catch(done);
});

it('should query', function (done) {
Expand Down Expand Up @@ -130,9 +131,10 @@ describe('Transform test with javascript', function () {
result(function (response) {
//console.log(JSON.stringify(response, null, 4));
response[0].content.should.have.property('timestamp');
response[0].content.userName.should.equal('rest-reader');
response[0].content.userName.should.equal('rest-transform-user'); // MLE-28684: transforms now run as rest-transform-user
done();
Comment on lines 131 to 135
}, done);
})
.catch(done);
});
/*it('should modify during write', function(done){
dbWriter.documents.write({
Expand Down
Loading