Changes for page api
Last modified by Ophion Admin on 2026/10/06 19:32
From version 5.1
edited by Ophion Admin
on 2026/10/06 16:20
on 2026/10/06 16:20
Change comment:
There is no comment for this version
To version 7.1
edited by Ophion Admin
on 2026/10/06 19:32
on 2026/10/06 19:32
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -3,6 +3,8 @@ 3 3 #set ($appClass = 'api.Code.apiClass') 4 4 ## Lowercase letters and digits, single hyphens only between the parts 5 5 #set ($namePattern = '[a-z0-9]+(-[a-z0-9]+)*') 6 +## Only users with edit right on the app home page may create APIs 7 +#set ($canCreate = $xwiki.hasAccessLevel('edit', $xcontext.user, "${appSpace}.WebHome")) 6 6 ## Collect all AWM apps: data class name -> app title 7 7 #set ($apps = {}) 8 8 #set ($xwql = "select doc.fullName from Document doc, doc.object(AppWithinMinutes.LiveTableClass) as app order by doc.fullName") ... ... @@ -56,7 +56,7 @@ 56 56 #end 57 57 #end 58 58 #set ($errorMsg = '') 59 -#if ("$!request.createEntry" == '1') 61 +#if ("$!request.createEntry" == '1' && $canCreate) 60 60 #if (!$services.csrf.isTokenValid("$!request.form_token")) 61 61 #set ($errorMsg = 'Invalid form token, please try again.') 62 62 #elseif (!$name.matches($namePattern)) ... ... @@ -91,6 +91,7 @@ 91 91 /* Hide the default AWM "Add new entry" button */ 92 92 ul.actions a.action.add, a.action.add { display: none !important; } 93 93 </style> 96 +#if ($canCreate) 94 94 <form action="$doc.getURL()" method="post" class="form-inline"> 95 95 <input type="hidden" name="form_token" value="$!services.csrf.token"/> 96 96 <!-- Changing the app or the field reloads the form without creating anything --> ... ... @@ -116,6 +116,7 @@ 116 116 pattern="$namePattern" title="Lowercase letters, digits and hyphens only"/> 117 117 <button type="submit" name="createEntry" value="1" class="btn btn-primary">Create API</button> 118 118 </form> 122 +#end 119 119 {{/html}} 120 120 {{/velocity}} 121 121 ... ... @@ -123,6 +123,7 @@ 123 123 #set ($columnsProperties = { 124 124 'doc.title': {"link":"view"}, 125 125 'sourceClass': {}, 130 + 'getUrl': {"html":true,"sortable":false,"filterable":false}, 126 126 'doc.location': {"html":true}, 127 127 'doc.date': {}, 128 128 'doc.author': {"link":"author"}, ... ... @@ -137,6 +137,6 @@ 137 137 'selectedColumn': 'doc.title', 138 138 'defaultOrder': 'asc' 139 139 }) 140 -#set ($columns = ['doc.title', 'sourceClass', 'doc.location', 'doc.date', 'doc.author', '_actions']) 145 +#set ($columns = ['doc.title', 'sourceClass', 'getUrl', 'doc.location', 'doc.date', 'doc.author', '_actions']) 141 141 #livetable('api' $columns $columnsProperties $options) 142 142 {{/velocity}}