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

role-strategy-plugin - No signature of method: com.michelin.cio.hudson.plugins.rolestrategy.Role.addPermissionEntry()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • role-strategy-plugin
    • None
    • Jenkins 2.414 and role-strategy-plugin version 670.vc71a_a_c00039e

      The issue might have been introduced by change: https://issues.jenkins.io/browse/JENKINS-68755. The GitHub change reference is: https://github.com/jenkinsci/role-strategy-plugin/pull/230

      We installed the latest role-strategy-plugin (670.vc71a_a_c00039e) and tried to use the example in the Readme but we are getting the following:

      groovy.lang.MissingMethodException: No signature of method: com.michelin.cio.hudson.plugins.rolestrategy.Role.addPermissionEntry() is applicable for argument types: (com.michelin.cio.hudson.plugins.rolestrategy.PermissionEntry) values: [PermissionEntry{type=USER, sid='admin'}]
              at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:71)
              at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:48)
              at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
              at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
              at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128) 

      Code snip:

      import com.michelin.cio.hudson.plugins.rolestrategy.AuthorizationType
      import com.michelin.cio.hudson.plugins.rolestrategy.PermissionEntry
      import com.michelin.cio.hudson.plugins.rolestrategy.RoleBasedAuthorizationStrategy
      import com.michelin.cio.hudson.plugins.rolestrategy.Role
      import com.synopsys.arc.jenkins.plugins.rolestrategy.RoleType
      import hudson.security.Permission
      import jenkins.model.Jenkins
      
      
      Jenkins jenkins = Jenkins.get()
      def rbas = new RoleBasedAuthorizationStrategy()
      
      /* create admin role */
      Set<Permission> permissions = new HashSet<>();
      permissions.add(Jenkins.ADMINISTER)
      Role adminRole = new Role("admin", permissions)
      
      /* assign admin role to user 'admin' */
      adminRole.addPermissionEntry(new PermissionEntry(AuthorizationType.USER, 'admin'))
      /* assign admin role to group 'administrators' */
      adminRole.addPermissionEntry(new PermissionEntry(AuthorizationType.GROUP, 'administrators'))
      
      globalRoleMap = rbas.getRoleMap(RoleType.Global)
      globalRoleMap.addRole(adminRole)
      
      jenkins.setAuthorizationStrategy(rbas)
      
      jenkins.save() 

            mawinter69 Markus Winter
            andrea_lai Andrea Lai
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: