[JIRA] (JENKINS-57832) How to add permission in GlobalMatrixAuthorizationStrategy through the groovy - for hudson.sercurity.item.Move

15 views
Skip to first unread message

palraj.sarathkumar@in.bosch.com (JIRA)

unread,
Jun 4, 2019, 1:30:02 AM6/4/19
to jenkinsc...@googlegroups.com
Sarath created an issue
 
Jenkins / New Feature JENKINS-57832
How to add permission in GlobalMatrixAuthorizationStrategy through the groovy - for hudson.sercurity.item.Move
Issue Type: New Feature New Feature
Assignee: Daniel Beck
Attachments: image-2019-06-04-10-57-23-906.png, image-2019-06-04-10-57-25-978.png
Components: matrix-auth-plugin
Created: 2019-06-04 05:29
Priority: Minor Minor
Reporter: Sarath
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

palraj.sarathkumar@in.bosch.com (JIRA)

unread,
Jun 4, 2019, 1:37:02 AM6/4/19
to jenkinsc...@googlegroups.com

palraj.sarathkumar@in.bosch.com (JIRA)

unread,
Jun 4, 2019, 1:40:02 AM6/4/19
to jenkinsc...@googlegroups.com

palraj.sarathkumar@in.bosch.com (JIRA)

unread,
Jun 4, 2019, 1:40:02 AM6/4/19
to jenkinsc...@googlegroups.com
Sarath commented on New Feature JENKINS-57832
 
Re: How to add permission in GlobalMatrixAuthorizationStrategy through the groovy - for hudson.sercurity.item.Move

Could you anyone help me on this.. i have wrote groovy scripts for adding permissions in Matrix-authorization. it works excepted. but only thing i can not able to update the Move options in Job .

 

import jenkins.model.*

import hudson.security.*

import hudson.model.*

import com.cloudbees.plugins.*

import hudson.scm.*

 

 

def userName = "{{ jenkins_admins }}"

String[] param= userName.split(',')

def instance = Jenkins.getInstance()

def strategy = new hudson.security.GlobalMatrixAuthorizationStrategy()

 

for( def uname : param ){

           

    /** Enable READ rights for Anonymous & Authenticated Users */

    strategy.add(Jenkins.READ, 'anonymous')

    strategy.add(Jenkins.READ, 'authenticated')

 

    /** Enable Overall permissions */

    strategy.add(Jenkins.ADMINISTER, uname)

    strategy.add(Jenkins.READ, uname)

 

    /** Enable Credentials permissions */

    strategy.add(credentials.CredentialsProvider.CREATE, uname)

    strategy.add(credentials.CredentialsProvider.DELETE, uname)

    strategy.add(credentials.CredentialsProvider.UPDATE, uname)

    strategy.add(credentials.CredentialsProvider.VIEW, uname)

    strategy.add(credentials.CredentialsProvider.MANAGE_DOMAINS, uname)

 

 

    /** Enable Agent permissions */

    strategy.add(Jenkins.MasterComputer.BUILD, uname)

    strategy.add(Jenkins.MasterComputer.CONFIGURE, uname)

    strategy.add(Jenkins.MasterComputer.CONNECT, uname)

    strategy.add(Jenkins.MasterComputer.CREATE, uname)

    strategy.add(Jenkins.MasterComputer.DELETE, uname)

    strategy.add(Jenkins.MasterComputer.DISCONNECT, uname)

 

    /** Enable Job permissions */

    strategy.add(Item.BUILD, uname)

    strategy.add(Item.CANCEL, uname)

    strategy.add(Item.CONFIGURE, uname)

    strategy.add(Item.CREATE, uname)

    strategy.add(Item.DELETE, uname)

    strategy.add(Item.DISCOVER, uname)

    strategy.add(Item.READ, uname)

    strategy.add(Item.WORKSPACE, uname)

    strategy.add(Item.MOVE, uname)   /** Its not working seems below error */  

   

/** Enable Run permissions */

    strategy.add(Run.DELETE, uname)

    strategy.add(Run.UPDATE, uname)

/**    strategy.add(Run.REPLAY, uname) */

 

    /** Enable View permissions */

    strategy.add(View.READ, uname)

    strategy.add(View.DELETE, uname)

    strategy.add(View.CREATE, uname)

    strategy.add(View.CONFIGURE, uname)

 

    /** Enable Tag permission */

 

    strategy.add(SCM.TAG, uname)

 

instance.setAuthorizationStrategy(strategy)

 

instance.save()

}

palraj.sarathkumar@in.bosch.com (JIRA)

unread,
Jun 4, 2019, 1:41:02 AM6/4/19
to jenkinsc...@googlegroups.com
Sarath edited a comment on New Feature JENKINS-57832
Could you anyone help me on this.. i have wrote groovy scripts for adding permissions in Matrix-authorization. it works excepted. but only thing i can not able to update the *Move*

options in *Job .  !2019-06-04_11h02_43.png|thumbnail!*

 

{color:#de350b}strategy.add(Item.MOVE, uname) – Is not working
{color}

=========================================================

    {color:#de350b}strategy.add(Item.MOVE, uname)   /** Its not working seems below error */   !2019-06-04_11h09_08.png|thumbnail! {color}


   

/** Enable Run permissions */

    strategy.add(Run.DELETE, uname)

    strategy.add(Run.UPDATE, uname)

/**    strategy.add(Run.REPLAY, uname) */

 

    /** Enable View permissions */

    strategy.add(View.READ, uname)

    strategy.add(View.DELETE, uname)

    strategy.add(View.CREATE, uname)

    strategy.add(View.CONFIGURE, uname)

 

    /** Enable Tag permission */

 

    strategy.add(SCM.TAG, uname)

 

instance.setAuthorizationStrategy(strategy)

 

instance.save()

}

dbeck@cloudbees.com (JIRA)

unread,
Jun 4, 2019, 2:42:01 AM6/4/19
to jenkinsc...@googlegroups.com
Daniel Beck closed an issue as Not A Defect
 

This is an issue tracker, not a support site. Please don't ask "how to" questions here.

Change By: Daniel Beck
Status: Open Closed
Resolution: Not A Defect

adam.gabrys@live.com (JIRA)

unread,
Jan 9, 2020, 9:06:02 AM1/9/20
to jenkinsc...@googlegroups.com
Adam Gabryś commented on New Feature JENKINS-57832
 
Re: How to add permission in GlobalMatrixAuthorizationStrategy through the groovy - for hudson.sercurity.item.Move

I also need this information. I used Google and found only this ticket and nothing more I started searching in plugins and finally I found it

  • Item.Move is defined in com.cloudbees.hudson.plugins.folder.relocate.RelocationAction class (CloudBees Folders plugin plugin)
  • Run.Replay is defined in org.jenkinsci.plugins.workflow.cps.replay.ReplayAction class (Pipeline: Groovy plugin)

More details here:

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

adam.gabrys@live.com (JIRA)

unread,
Jan 9, 2020, 9:07:03 AM1/9/20
to jenkinsc...@googlegroups.com
Adam Gabryś edited a comment on New Feature JENKINS-57832
I also need this information. I used Google and found only this ticket and nothing more :( I started searching in plugins and finally I found it :)

* Item.Move is defined in {{com.cloudbees.hudson.plugins.folder.relocate.RelocationAction}} class ([CloudBees Folders plugin|https://plugins.jenkins.io/cloudbees-folder]
plugin )
* Run.Replay is defined in {{org.jenkinsci.plugins.workflow.cps.replay.ReplayAction}} class ([Pipeline: Groovy
plugin |https://plugins.jenkins.io/workflow-cps] plugin )

More details here:
* [Where is hudson.model.Item.Move permission object defined?|https://stackoverflow.com/q/59665525/4944847]
* [Where is hudson.model.Run.Replay permission object defined?|https://stackoverflow.com/q/59665635/4944847]
Reply all
Reply to author
Forward
0 new messages