Matrix Authorization Strategy-How to grant job permissions for a user in Jenkins?

September 23, 2022

Overview

Have you ever been in the case that you need to allow some users who can see some Jenkins jobs instead of all of them in your Jenkins System?. If you say yes then you are the right topic for adding this feature in your Jenkins System. I know there are lots of topics on the internet talking about this plugin. However, some documents are not full step or some videos doesn’t have an explanation from the creator, I want to write a document that is easy for beginners. For solving that problem, we will use the “Matrix Authorization Strategy” plugin. This is plugin allows you controlling job permission on each project with specific users who can do something on that job.

Prerequisite:

  • Having Jenkins, creating two users (devops-admin role and developer - normal role)
  • Software version: java: 1.8, Jenkins version: 2.190.1

How to implement

Let me started that step. We will go step by step.

  • Step 1: Install plugin Matrix Authorization Strategy in Jenkins with admin user.

Accessing to the Manager Plugins setting.

Click to available tab and search plugin call “Matrix Authorization Strategy” image Accessing to Manage Plugins interface Here are the result after installing the plugin and reboot the Jenkins. image Installing Matrix Authorization Strategy information

Step 2: Setup global permission for users by accessing here. image How to access to Global Security Configuration

The setting includes enabling authentication and basic permission for some users. Here are I have two users Devops(admin user who can do anything) and developer(A staff who can only see some projects)

image Global permissions setting

  • Step 3: Create a job(Accessing to Jenkins -> Click to New Item(Filling in your job Name) and setting permission for a user(You choose the job and click to Configure)

In my situation, I will create a job call authorization-job-example and allow the Developer user can build, cancel the authorization-job-example job. image Setting permission for a user in the job settings That is all. Now you can log in by developer user and you only see the job call “authorization-job-example” and you only see Build and cancel button.

image authorization-job-example result

Hope this article will help you. Thank you for reading!

  • Tags
    • Jenkins
    • Jenkins Permission

Feel free to contact lamhaison@gmail.com for Devops Jobs