Add "readOnly"-endpoint parameter to repo-config endpoint

The repo-config endpoint allows plugins to add new config sections to
the repository configuration. So far, each plugin had to determine itself,
whether the options were changeable by the logged in user. Thus, each
plugin that wanted to disable form fields, if the user was not the owner
of the repo, had to perform the same REST-request, which led to an
unnecessarily high number of requests.

This change adds a parameter to the repo-config endpoint, which forwards
the boolean _readOnly variable to the plugin to be used to decide, whether
an option should be enabled to the logged in user.

Change-Id: Id1d7db2184d84d4ded157bed9a0492f516eeb53e
This commit is contained in:
Thomas Draebing
2019-10-30 11:10:30 +01:00
parent 002ea27286
commit 7b82696578
2 changed files with 5 additions and 0 deletions

View File

@@ -114,6 +114,10 @@ In addition to default parameters, the following are available:
+
String name of the repository currently being configured.
* `readOnly`
+
Boolean whether the repository configuration is read only by the logged in user.
=== settings-menu-item
This endpoint is situated at the end of the navigation menu in the settings
screen.

View File

@@ -353,6 +353,7 @@ limitations under the License.
</fieldset>
<gr-endpoint-decorator name="repo-config">
<gr-endpoint-param name="repoName" value="[[repo]]"></gr-endpoint-param>
<gr-endpoint-param name="readOnly" value="[[_readOnly]]"></gr-endpoint-param>
</gr-endpoint-decorator>
</div>
</div>