@@ -95,7 +95,7 @@ public static function _createACLFromJSON($data)
95
95
$ acl = new self ();
96
96
foreach ($ data as $ id => $ permissions ) {
97
97
if (!is_string ($ id )) {
98
- throw new Exception ('Tried to create an ACL with an invalid userId. ' );
98
+ throw new Exception ('Tried to create an ACL with an invalid userId. ' , 104 );
99
99
}
100
100
foreach ($ permissions as $ accessType => $ value ) {
101
101
if ($ accessType !== 'read ' && $ accessType !== 'write ' ) {
@@ -169,7 +169,8 @@ private function setAccess($accessType, $userId, $allowed)
169
169
}
170
170
if (!is_string ($ userId )) {
171
171
throw new ParseException (
172
- 'Invalid target for access control. '
172
+ 'Invalid target for access control. ' ,
173
+ 104
173
174
);
174
175
}
175
176
if (!isset ($ this ->permissionsById [$ userId ])) {
@@ -219,7 +220,7 @@ private function getAccess($accessType, $userId)
219
220
public function setReadAccess ($ userId , $ allowed )
220
221
{
221
222
if (!$ userId ) {
222
- throw new Exception ('cannot setReadAccess for null userId ' );
223
+ throw new Exception ('cannot setReadAccess for null userId ' , 104 );
223
224
}
224
225
$ this ->setAccess ('read ' , $ userId , $ allowed );
225
226
}
@@ -239,7 +240,7 @@ public function setReadAccess($userId, $allowed)
239
240
public function getReadAccess ($ userId )
240
241
{
241
242
if (!$ userId ) {
242
- throw new Exception ('cannot getReadAccess for null userId ' );
243
+ throw new Exception ('cannot getReadAccess for null userId ' , 104 );
243
244
}
244
245
245
246
return $ this ->getAccess ('read ' , $ userId );
@@ -256,7 +257,7 @@ public function getReadAccess($userId)
256
257
public function setWriteAccess ($ userId , $ allowed )
257
258
{
258
259
if (!$ userId ) {
259
- throw new Exception ('cannot setWriteAccess for null userId ' );
260
+ throw new Exception ('cannot setWriteAccess for null userId ' , 104 );
260
261
}
261
262
$ this ->setAccess ('write ' , $ userId , $ allowed );
262
263
}
@@ -276,7 +277,7 @@ public function setWriteAccess($userId, $allowed)
276
277
public function getWriteAccess ($ userId )
277
278
{
278
279
if (!$ userId ) {
279
- throw new Exception ('cannot getWriteAccess for null userId ' );
280
+ throw new Exception ('cannot getWriteAccess for null userId ' , 104 );
280
281
}
281
282
282
283
return $ this ->getAccess ('write ' , $ userId );
@@ -333,7 +334,7 @@ public function getPublicWriteAccess()
333
334
public function setUserReadAccess ($ user , $ allowed )
334
335
{
335
336
if (!$ user ->getObjectId ()) {
336
- throw new Exception ('cannot setReadAccess for a user with null id ' );
337
+ throw new Exception ('cannot setReadAccess for a user with null id ' , 104 );
337
338
}
338
339
$ this ->setReadAccess ($ user ->getObjectId (), $ allowed );
339
340
}
@@ -353,7 +354,7 @@ public function setUserReadAccess($user, $allowed)
353
354
public function getUserReadAccess ($ user )
354
355
{
355
356
if (!$ user ->getObjectId ()) {
356
- throw new Exception ('cannot getReadAccess for a user with null id ' );
357
+ throw new Exception ('cannot getReadAccess for a user with null id ' , 104 );
357
358
}
358
359
359
360
return $ this ->getReadAccess ($ user ->getObjectId ());
@@ -370,7 +371,7 @@ public function getUserReadAccess($user)
370
371
public function setUserWriteAccess ($ user , $ allowed )
371
372
{
372
373
if (!$ user ->getObjectId ()) {
373
- throw new Exception ('cannot setWriteAccess for a user with null id ' );
374
+ throw new Exception ('cannot setWriteAccess for a user with null id ' , 104 );
374
375
}
375
376
$ this ->setWriteAccess ($ user ->getObjectId (), $ allowed );
376
377
}
@@ -390,7 +391,7 @@ public function setUserWriteAccess($user, $allowed)
390
391
public function getUserWriteAccess ($ user )
391
392
{
392
393
if (!$ user ->getObjectId ()) {
393
- throw new Exception ('cannot getWriteAccess for a user with null id ' );
394
+ throw new Exception ('cannot getWriteAccess for a user with null id ' , 104 );
394
395
}
395
396
396
397
return $ this ->getWriteAccess ($ user ->getObjectId ());
@@ -459,7 +460,8 @@ private static function validateRoleState($role)
459
460
{
460
461
if (!$ role ->getObjectId ()) {
461
462
throw new Exception (
462
- 'Roles must be saved to the server before they can be used in an ACL. '
463
+ 'Roles must be saved to the server before they can be used in an ACL. ' ,
464
+ 104
463
465
);
464
466
}
465
467
}
0 commit comments