Skip to content

Commit

Permalink
Version 0.9.45
Browse files Browse the repository at this point in the history
- Added support for custom Group (GID) for Plugins.
  • Loading branch information
jhuckaby committed Mar 13, 2024
1 parent 1fb0515 commit 9d2cfad
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
9 changes: 7 additions & 2 deletions htdocs/js/pages/admin/Plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,14 @@ Class.add( Page.Admin, {
'<div class="plugin_params_label">Run as User (UID):</div>' +
'<div class="plugin_params_content"><input type="text" id="fe_ep_uid" size="20" value="'+escape_text_field_value(plugin.uid)+'" placeholder="" spellcheck="false"/></div>' +

'<div class="plugin_params_label">Run as Group (GID):</div>' +
'<div class="plugin_params_content"><input type="text" id="fe_ep_gid" size="20" value="'+escape_text_field_value(plugin.gid)+'" placeholder="" spellcheck="false"/></div>' +

'</fieldset>'
);
html += get_form_table_caption(
"Optionally enter a working directory path, and/or a custom UID for the Plugin.<br>" +
"The UID may be either numerical or a string ('root', 'wheel', etc.)."
"Optionally enter a working directory path, and/or a custom UID/GID for the Plugin.<br>" +
"The UID/GID may be either numerical or strings ('root', 'wheel', etc.)."
);
html += get_form_table_spacer();

Expand Down Expand Up @@ -677,8 +680,10 @@ Class.add( Page.Admin, {

plugin.cwd = trim( $('#fe_ep_cwd').val() );
plugin.uid = trim( $('#fe_ep_uid').val() );
plugin.gid = trim( $('#fe_ep_gid').val() );

if (plugin.uid.match(/^\d+$/)) plugin.uid = parseInt( plugin.uid );
if (plugin.gid.match(/^\d+$/)) plugin.gid = parseInt( plugin.gid );

return plugin;
}
Expand Down
17 changes: 17 additions & 0 deletions lib/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,23 @@ module.exports = Class.create({
return;
}

if (job.gid) {
var grp_info = Tools.getgrnam( job.gid, true );
if (grp_info) {
child_opts.gid = grp_info.gid;
}
else {
// group not found
job.pid = 0;
job.code = 1;
job.description = "Plugin Error: Group does not exist: " + job.gid;
this.logError("child", job.description);
this.activeJobs[ job.id ] = job;
this.finishLocalJob( job );
return;
}
}

child_opts.uid = parseInt( child_opts.uid );
child_opts.gid = parseInt( child_opts.gid );

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Cronicle",
"version": "0.9.44",
"version": "0.9.45",
"description": "A simple, distributed task scheduler and runner with a web based UI.",
"author": "Joseph Huckaby <jhuckaby@gmail.com>",
"homepage": "https://github.com/jhuckaby/Cronicle",
Expand Down

0 comments on commit 9d2cfad

Please sign in to comment.