File tree Expand file tree Collapse file tree 1 file changed +21
-4
lines changed
src/Azure.DataApiBuilder.Mcp/BuiltInTools Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -368,13 +368,30 @@ private static List<object> BuildParameterMetadataInfo(List<ParameterMetadata>?
368368 /// <returns>A list of permissions available to the entity</returns>
369369 private static string [ ] BuildPermissionsInfo ( Entity entity )
370370 {
371- HashSet < string > permissions = new ( ) ;
371+ if ( entity . Permissions == null )
372+ {
373+ return Array . Empty < string > ( ) ;
374+ }
375+
376+ bool isStoredProcedure = entity . Source . Type == EntitySourceType . StoredProcedure ;
377+ HashSet < EntityActionOperation > validOperations = isStoredProcedure
378+ ? EntityAction . ValidStoredProcedurePermissionOperations
379+ : EntityAction . ValidPermissionOperations ;
372380
373- if ( entity . Permissions != null )
381+ HashSet < string > permissions = new ( StringComparer . OrdinalIgnoreCase ) ;
382+
383+ foreach ( EntityPermission permission in entity . Permissions )
374384 {
375- foreach ( EntityPermission permission in entity . Permissions )
385+ foreach ( EntityAction action in permission . Actions )
376386 {
377- foreach ( EntityAction action in permission . Actions )
387+ if ( action . Action == EntityActionOperation . All )
388+ {
389+ foreach ( EntityActionOperation op in validOperations )
390+ {
391+ permissions . Add ( op . ToString ( ) . ToUpperInvariant ( ) ) ;
392+ }
393+ }
394+ else
378395 {
379396 permissions . Add ( action . Action . ToString ( ) . ToUpperInvariant ( ) ) ;
380397 }
You can’t perform that action at this time.
0 commit comments