generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 107
Closed
Labels
feature-requestThis issue requets a substantial new featureThis issue requets a substantial new feature
Description
Category
User level API features/changes
Describe the feature you'd like to request
Right now there is no way to update an entity inside an Entities object. For instance, if in my app, a user was assigned to a user group (a parent relation in cedar world), I'd like to be able to set an individual entity and have the relations updated:
let entities = Entities::from_entities(entities_from_db, schema)?;
// update
let update_or_insert_operation = entities.set(entity, schema)?;
// OR
entities.add_entities([entity], schema); // overwrite rather than error on duplicate.
Describe alternatives you've considered
This is what I'm doing currently:
let mut new_entities: Vec<_> = entities
.iter()
.filter(|cur_entity| entity.uid() != cur_entity.uid())
.cloned()
.collect();
new_entities.push(entity);
entities = Entities::from_entities(new_entities.into_iter(), schema)?;
It just seems unnecessary to clone the entire entities object, just to update one entity, though I am unfamiliar with the deeper workings of the cedar_policy_core module.
Additional context
No response
Is this something that you'd be interested in working on?
- 👋 I may be able to implement this feature request
-
⚠️ This feature might incur a breaking change
Metadata
Metadata
Assignees
Labels
feature-requestThis issue requets a substantial new featureThis issue requets a substantial new feature