nearform / udaru

Open source Access Manager for node.js
https://nearform.github.io/udaru
MIT License
124 stars 19 forks source link

allow underscores on id fields for backward compatibility #549

Closed cianfoley-nearform closed 6 years ago

cianfoley-nearform commented 6 years ago

underscores now whitelisted in all fields to cater for backward compatibility for teams in particular (as underscores were previously enforced).

Migration script updated with regex to cater for underscore and also validation.js in core updated too for all ids

As team paths only allow underscores and alphanumerics (ltree restriction), we must convert hyphens in ids to underscores in the path. this may cause clashes and undesired behaviour so an extra constraint was added to ensure path is unique in migration script.

a test case was added to ensure the database cannot contain two teams with the same path when ids with hypens and underscores convert to to the same path.

paths will be returned with hypens from a user perspective (for easier use of API when we eventually expose calls that use the path), as our default id separator is hyphen (a bug relating to this was fixed in nested teams)

Updated some formatting in overview, and fixed problems in example.md

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.02%) to 93.148% when pulling 6686b4ff49ab934b2d99990666fb7b0d6e9353e7 on allow-underscores-in-id-whitelist into 89fe1eb576a15641dc2e8839654df6ef71c4810a on master.