@@ -100,8 +100,6 @@ func TestAuthorizeAllEndpoints(t *testing.T) {
100
100
101
101
"PUT:/api/v2/organizations/{organization}/members/{user}/roles" : {NoAuthorize : true },
102
102
"GET:/api/v2/organizations/{organization}/provisionerdaemons" : {NoAuthorize : true },
103
- "POST:/api/v2/organizations/{organization}/templates" : {NoAuthorize : true },
104
- "GET:/api/v2/organizations/{organization}/templates" : {NoAuthorize : true },
105
103
"GET:/api/v2/organizations/{organization}/templates/{templatename}" : {NoAuthorize : true },
106
104
"POST:/api/v2/organizations/{organization}/templateversions" : {NoAuthorize : true },
107
105
"POST:/api/v2/organizations/{organization}/workspaces" : {NoAuthorize : true },
@@ -110,8 +108,6 @@ func TestAuthorizeAllEndpoints(t *testing.T) {
110
108
"GET:/api/v2/parameters/{scope}/{id}" : {NoAuthorize : true },
111
109
"DELETE:/api/v2/parameters/{scope}/{id}/{name}" : {NoAuthorize : true },
112
110
113
- "DELETE:/api/v2/templates/{template}" : {NoAuthorize : true },
114
- "GET:/api/v2/templates/{template}" : {NoAuthorize : true },
115
111
"GET:/api/v2/templates/{template}/versions" : {NoAuthorize : true },
116
112
"PATCH:/api/v2/templates/{template}/versions" : {NoAuthorize : true },
117
113
"GET:/api/v2/templates/{template}/versions/{templateversionname}" : {NoAuthorize : true },
@@ -185,7 +181,23 @@ func TestAuthorizeAllEndpoints(t *testing.T) {
185
181
AssertAction : rbac .ActionRead ,
186
182
AssertObject : workspaceRBACObj ,
187
183
},
188
-
184
+ "GET:/api/v2/organizations/{organization}/templates" : {
185
+ StatusCode : http .StatusOK ,
186
+ AssertAction : rbac .ActionRead ,
187
+ AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ).WithID (template .ID .String ()),
188
+ },
189
+ "POST:/api/v2/organizations/{organization}/templates" : {
190
+ AssertAction : rbac .ActionCreate ,
191
+ AssertObject : rbac .ResourceTemplate .InOrg (organization .ID ),
192
+ },
193
+ "DELETE:/api/v2/templates/{template}" : {
194
+ AssertAction : rbac .ActionDelete ,
195
+ AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ).WithID (template .ID .String ()),
196
+ },
197
+ "GET:/api/v2/templates/{template}" : {
198
+ AssertAction : rbac .ActionRead ,
199
+ AssertObject : rbac .ResourceTemplate .InOrg (template .OrganizationID ).WithID (template .ID .String ()),
200
+ },
189
201
"POST:/api/v2/files" : {AssertAction : rbac .ActionCreate , AssertObject : rbac .ResourceFile },
190
202
"GET:/api/v2/files/{fileHash}" : {AssertAction : rbac .ActionRead ,
191
203
AssertObject : rbac .ResourceFile .WithOwner (admin .UserID .String ()).WithID (file .Hash )},
@@ -226,6 +238,7 @@ func TestAuthorizeAllEndpoints(t *testing.T) {
226
238
route = strings .ReplaceAll (route , "{workspacebuild}" , workspace .LatestBuild .ID .String ())
227
239
route = strings .ReplaceAll (route , "{workspacename}" , workspace .Name )
228
240
route = strings .ReplaceAll (route , "{workspacebuildname}" , workspace .LatestBuild .Name )
241
+ route = strings .ReplaceAll (route , "{template}" , template .ID .String ())
229
242
route = strings .ReplaceAll (route , "{hash}" , file .Hash )
230
243
231
244
resp , err := client .Request (context .Background (), method , route , nil )
0 commit comments