-
Improvement
-
Resolution: Unresolved
-
Minor
While many job types could reasonably be created by any user with Item.CREATE, some types inherently require more specialized permissions to create, configure, and run: backup jobs, Groovy script jobs, etc. While it is possible to check these other permissions "later", it would be much better to just forbid general users from creating such jobs to begin with—do not even show the option.
Proposal: add a method to TopLevelItemDescriptor, say boolean canCreate(ItemGroup parent, AccessControlled acl), checking whether the current user is allowed to create an instance of this job type in the selected folder. The default implementation would return true, but a subclass could perform an access check on the target folder.
ItemGroupMixIn would be responsible for calling the new method to prevent crafted form submissions from being accepted, but the main usage would be from e.g. View/newJob.jelly calling Items.all() and using <n:form>.