25
25
*/
26
26
class InstancesPresenter extends BasePresenter
27
27
{
28
-
29
28
/**
30
29
* @var Instances
31
30
* @inject
@@ -94,7 +93,9 @@ function (Instance $instance) {
94
93
return $ instance ->isAllowed ();
95
94
}
96
95
);
97
- $ this ->sendSuccessResponse ($ this ->instanceViewFactory ->getInstances ($ instances ));
96
+ $ this ->sendSuccessResponse (
97
+ $ this ->instanceViewFactory ->getInstances ($ instances , $ this ->getCurrentUserOrNull ())
98
+ );
98
99
}
99
100
100
101
public function checkCreateInstance ()
@@ -109,7 +110,8 @@ public function checkCreateInstance()
109
110
* @POST
110
111
* @Param(type="post", name="name", validation="string:2..", description="Name of the instance")
111
112
* @Param(type="post", name="description", required=false, description="Description of the instance")
112
- * @Param(type="post", name="isOpen", validation="bool", description="Should the instance be open for registration?")
113
+ * @Param(type="post", name="isOpen", validation="bool",
114
+ * description="Should the instance be open for registration?")
113
115
* @throws ForbiddenRequestException
114
116
*/
115
117
public function actionCreateInstance ()
@@ -129,7 +131,7 @@ public function actionCreateInstance()
129
131
$ this ->instances ->persist ($ instance ->getRootGroup (), false );
130
132
$ this ->instances ->persist ($ localizedRootGroup , false );
131
133
$ this ->instances ->persist ($ instance );
132
- $ this ->sendSuccessResponse ($ this ->instanceViewFactory ->getInstance ($ instance ), IResponse::S201_CREATED );
134
+ $ this ->sendSuccessResponse ($ this ->instanceViewFactory ->getInstance ($ instance, $ user ), IResponse::S201_CREATED );
133
135
}
134
136
135
137
public function checkUpdateInstance (string $ id )
@@ -144,7 +146,8 @@ public function checkUpdateInstance(string $id)
144
146
/**
145
147
* Update an instance
146
148
* @POST
147
- * @Param(type="post", name="isOpen", validation="bool", required=false, description="Should the instance be open for registration?")
149
+ * @Param(type="post", name="isOpen", validation="bool", required=false,
150
+ * description="Should the instance be open for registration?")
148
151
* @param string $id An identifier of the updated instance
149
152
*/
150
153
public function actionUpdateInstance (string $ id )
@@ -159,7 +162,7 @@ public function actionUpdateInstance(string $id)
159
162
160
163
$ instance ->setIsOpen ($ isOpen );
161
164
$ this ->instances ->persist ($ instance );
162
- $ this ->sendSuccessResponse ($ this ->instanceViewFactory ->getInstance ($ instance ));
165
+ $ this ->sendSuccessResponse ($ this ->instanceViewFactory ->getInstance ($ instance, $ this -> getCurrentUser () ));
163
166
}
164
167
165
168
public function checkDeleteInstance (string $ id )
@@ -208,7 +211,7 @@ public function checkDetail(string $id)
208
211
public function actionDetail (string $ id )
209
212
{
210
213
$ instance = $ this ->instances ->findOrThrow ($ id );
211
- $ this ->sendSuccessResponse ($ this ->instanceViewFactory ->getInstance ($ instance ));
214
+ $ this ->sendSuccessResponse ($ this ->instanceViewFactory ->getInstance ($ instance, $ this -> getCurrentUser () ));
212
215
}
213
216
214
217
public function checkLicences (string $ id )
@@ -268,9 +271,12 @@ public function checkUpdateLicence(string $licenceId)
268
271
/**
269
272
* Update an existing license for an instance
270
273
* @POST
271
- * @Param(type="post", name="note", validation="string:2..255", required=false, description="A note for users or administrators")
272
- * @Param(type="post", name="validUntil", validation="string", required=false, description="Expiration date of the license")
273
- * @Param(type="post", name="isValid", validation="bool", required=false, description="Administrator switch to toggle licence validity")
274
+ * @Param(type="post", name="note", validation="string:2..255", required=false,
275
+ * description="A note for users or administrators")
276
+ * @Param(type="post", name="validUntil", validation="string", required=false,
277
+ * description="Expiration date of the license")
278
+ * @Param(type="post", name="isValid", validation="bool", required=false,
279
+ * description="Administrator switch to toggle licence validity")
274
280
* @param string $licenceId Identifier of the licence
275
281
* @throws NotFoundException
276
282
*/
0 commit comments