Skip to content

[JENKINS-41289] use readOnlyMode to include edit-config in show-config#314

Open
mawinter69 wants to merge 3 commits into
jenkinsci:masterfrom
mawinter69:readonlymode
Open

[JENKINS-41289] use readOnlyMode to include edit-config in show-config#314
mawinter69 wants to merge 3 commits into
jenkinsci:masterfrom
mawinter69:readonlymode

Conversation

@mawinter69
Copy link
Copy Markdown
Contributor

Setting var readOnlyMode in jelly will basically disable all inputs, buttons, selects. So in the show-config.jelly files we can just set this var and the include the edit-config. So we no longer need to double maintain the fields.
For those configs that add credentials check the readOnlyMode variable and disable the delete and add buttons accordingly

On order to view a job configuration when one has extended read but no configure it must be avoided that the permissions checks in doCheck and doFill methods check for configure only, they should also allow EXTENDED_READ.

Testing done

Interactive testing
create for each type a config, when credentials are there add and delete buttons are still there and all fields are editable
create freestyle job and add a buildwrapper to provide credentials, for each config type go to the view details link, all fields are readonly and there are no buttons to add/remove credentials.
(note that the email ext plugin provides 2 config file types but misses to provide show-config.jelly files, thus the view details link leads to broken pages, this problem existed before)

### Submitter checklist
- [x] Make sure you are opening from a **topic/feature/bugfix branch** (right side) and not your main branch!
- [x] Ensure that the pull request title represents the desired changelog entry
- [ ] Please describe what you did
- [ ] Link to relevant issues in GitHub or Jira
- [ ] Link to relevant pull requests, esp. upstream and downstream changes
- [ ] Ensure you have provided tests - that demonstrates feature works or fixes the issue

setting var readOnlyMode in the show-config jelly files allows to
include edit-config directly. For those that add credentials check the
readOnlyMode variable and disable the delete and add buttons accordingly
Allow extended read for the dofill and docheck methods so a job config
can be viewed with extended read permissions.
@mawinter69 mawinter69 requested a review from a team as a code owner February 5, 2024 15:32
@mawinter69
Copy link
Copy Markdown
Contributor Author

There is one drawback to this approach, the actual file content is no longer shown with codemirror but only as plain text. That would require a change in core to have textareas with codemirror in readonly mode keep the codemirror styling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant