You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of removing the agent then adding it back with new rules, the following code will cause multiple instances of the same rule to populate when run multiple times.
To Reproduce
Run the following code:
constisContainer=true;consturi="https://solidweb.me/jackson/demo-react/";constnewAccessRules={public: {read: true,write: false,append: false,control: false,},agent: {"https://solidweb.me/jackson/profile/card#me": {read: true,write: true,append: true,control: true,},},};// Code Copied from https://docs.inrupt.com/developer-tools/javascript/client-libraries/tutorial/manage-wac/// Fetch the SolidDataset and its associated ACLs, if available:constmyDatasetWithAcl=awaitgetSolidDatasetWithAcl(uri,{ fetch });// Obtain the SolidDataset's own ACL, if available,// or initialise a new one, if possible:letresourceAcl;if(!hasResourceAcl(myDatasetWithAcl)){if(!hasAccessibleAcl(myDatasetWithAcl)){returnnewAccessRuleFetchError(uri,"The current user does not have permission to change access rights to this Resource.",);}if(!hasFallbackAcl(myDatasetWithAcl)){returnnewAccessRuleFetchError("The current user does not have permission to see who currently has access to this Resource.",);}resourceAcl=createAclFromFallbackAcl(myDatasetWithAcl);}else{resourceAcl=getResourceAcl(myDatasetWithAcl);}// Give someone Control access to the given Resource:letupdatedAcl: AclDataset&WithChangeLog=resourceAcl;if(newAccessRules.public){if(isContainer){updatedAcl=setPublicDefaultAccess(updatedAcl,newAccessRules.public);}else{updatedAcl=setPublicResourceAccess(updatedAcl,newAccessRules.public);}}if(newAccessRules.agent){constsetAgentAccess=isContainer
? setAgentDefaultAccess
: setAgentResourceAccess;Object.entries(newAccessRules.agent).forEach(([webId,rules])=>{updatedAcl=setAgentAccess(updatedAcl,webId,rules);});}// Now save the ACL:awaitsaveAclFor(myDatasetWithAcl,updatedAcl,{ fetch });
Minimal reproduction
Expected result
Only one instance of each access rule is included.
Actual result
After running this function 4 times, this is the resulting acl:
Hey, I can't point out the specific issue but I have noticed that the Inrupt ACL libraries do not always interop properly with the Community Solid Server instances, and I've had to write my own functions when working on one server compared to another. IF you'd like I can try and dig up one instance I've encountered.
Search terms you've used
Duplicate rules
Bug description
Instead of removing the agent then adding it back with new rules, the following code will cause multiple instances of the same rule to populate when run multiple times.
To Reproduce
Run the following code:
Minimal reproduction
Expected result
Only one instance of each access rule is included.
Actual result
After running this function 4 times, this is the resulting acl:
Environment
Additional information
The text was updated successfully, but these errors were encountered: