feat: Add role-level permissions for agent sharing people picker

- Add PEOPLE_PICKER permission type with VIEW_USERS and VIEW_GROUPS permissions
  - Create custom middleware for query-aware permission validation
  - Implement permission-based type filtering in PeoplePicker component
  - Hide people picker UI when user lacks permissions, show only public toggle
  - Support granular access: users-only, groups-only, or mixed search modes
This commit is contained in:
Atef Bellaaj 2025-07-01 14:25:48 +02:00 committed by Danny Avila
parent b03341517d
commit 73fb4181fe
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
11 changed files with 220 additions and 32 deletions

View file

@ -37,6 +37,10 @@ const rolePermissionsSchema = new Schema(
[PermissionTypes.WEB_SEARCH]: {
[Permissions.USE]: { type: Boolean, default: true },
},
[PermissionTypes.PEOPLE_PICKER]: {
[Permissions.VIEW_USERS]: { type: Boolean, default: false },
[Permissions.VIEW_GROUPS]: { type: Boolean, default: false },
},
},
{ _id: false },
);
@ -67,6 +71,10 @@ const roleSchema: Schema<IRole> = new Schema({
[PermissionTypes.TEMPORARY_CHAT]: { [Permissions.USE]: true },
[PermissionTypes.RUN_CODE]: { [Permissions.USE]: true },
[PermissionTypes.WEB_SEARCH]: { [Permissions.USE]: true },
[PermissionTypes.PEOPLE_PICKER]: {
[Permissions.VIEW_USERS]: false,
[Permissions.VIEW_GROUPS]: false,
},
}),
},
});

View file

@ -35,5 +35,9 @@ export interface IRole extends Document {
[PermissionTypes.WEB_SEARCH]?: {
[Permissions.USE]?: boolean;
};
[PermissionTypes.PEOPLE_PICKER]?: {
[Permissions.VIEW_USERS]?: boolean;
[Permissions.VIEW_GROUPS]?: boolean;
};
};
}