Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-17358

Allow a TopLevelItemDescriptor to specify permissions needed to create an item


    • Similar Issues:


      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>.



          There are no comments yet on this issue.


            • Assignee:
              jglick Jesse Glick
              jglick Jesse Glick
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: