@@ -173,7 +173,7 @@ public <T extends Resource> void getAccessibleResourcesForCurrentUser(String res
173
173
try {
174
174
validateArguments (resourceIndex );
175
175
176
- ResourceParser <T > parser = ResourcePluginInfo .getInstance ().getResourceProviders ().get (resourceIndex ).getResourceParser ();
176
+ ResourceParser <T > parser = ResourcePluginInfo .getInstance ().getResourceProviders ().get (resourceIndex ).resourceParser ();
177
177
178
178
StepListener <Set <String >> resourceIdsListener = new StepListener <>();
179
179
StepListener <Set <T >> resourcesListener = new StepListener <>();
@@ -366,55 +366,6 @@ public void revokeAccess(
366
366
);
367
367
}
368
368
369
- /**
370
- * Checks if the current user has permission to modify a resource.
371
- * NOTE: Only admins and owners of the resource can modify the resource.
372
- * TODO: update this method to allow for other users to modify the resource.
373
- * @param resourceId The resource ID to check.
374
- * @param resourceIndex The resource index containing the resource.
375
- * @param listener The listener to be notified with the permission check result.
376
- */
377
- public void canModifyResource (String resourceId , String resourceIndex , ActionListener <Boolean > listener ) {
378
- try {
379
- validateArguments (resourceId , resourceIndex );
380
-
381
- final UserSubjectImpl userSubject = (UserSubjectImpl ) threadContext .getPersistent (
382
- ConfigConstants .OPENDISTRO_SECURITY_AUTHENTICATED_USER
383
- );
384
- final User user = (userSubject == null ) ? null : userSubject .getUser ();
385
-
386
- if (user == null ) {
387
- listener .onFailure (new ResourceSharingException ("No authenticated user available." ));
388
- return ;
389
- }
390
-
391
- StepListener <ResourceSharing > fetchDocListener = new StepListener <>();
392
- resourceSharingIndexHandler .fetchDocumentById (resourceIndex , resourceId , fetchDocListener );
393
-
394
- fetchDocListener .whenComplete (document -> {
395
- if (document == null ) {
396
- LOGGER .info ("Document {} does not exist in index {}" , resourceId , resourceIndex );
397
- // Either the document was deleted or has not been created yet. No permission check is needed for this.
398
- listener .onResponse (true );
399
- return ;
400
- }
401
-
402
- boolean isAdmin = adminDNs .isAdmin (user );
403
- boolean isOwner = isOwnerOfResource (document , user .getName ());
404
-
405
- if (!isAdmin && !isOwner ) {
406
- LOGGER .info ("User {} does not have access to delete the record {}" , user .getName (), resourceId );
407
- listener .onResponse (false );
408
- } else {
409
- listener .onResponse (true );
410
- }
411
- }, listener ::onFailure );
412
- } catch (Exception e ) {
413
- LOGGER .error ("Failed to check delete permission for resource {}" , resourceId , e );
414
- listener .onFailure (e );
415
- }
416
- }
417
-
418
369
/**
419
370
* Deletes a resource sharing record by its ID and the resource index it belongs to.
420
371
*
0 commit comments