jsp command run permission.

16 views
Skip to first unread message

Johnny Park

unread,
Mar 10, 2018, 12:26:48 AM3/10/18
to ScriptCraft - Scripting Minecraft

I am teaching my students scriptcraft.


What I want to do is to make the JavaScript code that students create available only to the student.


For example,


username1.js

command ('stoneblock1', function (parameters, player) {

var theDrone = new Drone (player);

theDrone.up ();

theDrone.chkpt ('start');

theDrone.box ('1', 3,1,2);

});


username2.js

command ('stoneblock2', function (parameters, player) {

var theDrone = new Drone (player);

theDrone.up ();

theDrone.chkpt ('start');

theDrone.box ('1', 3,1,2);

});


Let's say that the files created by each student are stored in the plugins folder.


I want username1.js to be able to run only username1 students.

In other words, username1 student can not run username2.js file.

So student 1 will be able to run / jsp stoneblock1, but stoneblock2 will not run due to permission issues.


Please answer me. Thank you.

Woody

unread,
Mar 13, 2018, 5:46:17 PM3/13/18
to ScriptCraft - Scripting Minecraft
Not sure exactly how this would work but could be worth exploring:
- put the code in username1/stoneblock.js username2/stoneblock.js
- find the code which loads/reloads the .js files in the plugin directory and duplicate it to read plugin/*/*.js as well and store the function names under username
- find the run / jsp code and duplicate modify it to e.g. ujsp which only looks for the functions under the callers username

cheers,
Woody
(More a Perl Programmer than a JS one!)

Mike Stay

unread,
Mar 13, 2018, 8:49:38 PM3/13/18
to ScriptCraft - Scripting Minecraft
Expose a function that looks up the user's username and then requires
"<username>.js" on their behalf, but don't expose require() itself.
Reply all
Reply to author
Forward
0 new messages