My app manages user data that is shared between users, with different permissions such as read-only, edit, superuser, rename, delete etc.
I'm weighing up two approaches to modelling the user permissions, the first is the simpler approach, the second involves more work but is more extensible, refactorable, I think.
(1) quick solution, hard-coding against user permission
properties:
-- basic data
CREATE TABLE symbol (
id INT,
name VARCHAR(255)
);
CREATE TABLE user (
id CHAR(10)
);
CREATE TABLE user_permission (
symbol_id INT,
user_id CHAR(10),
readable BIT,
writable BIT,
owner BIT,
rename BIT,
deletion BIT
);
(2) complete solution, hard-coding against entitlements
:
The areas I'm considering are:
- extensibility - need or not to change model & schema
- microservices - possibilities to spin off into a separate DB?
- performance - filter algos, number of joins in queries
- no-sql caching - no idea but denormalising user permissions sounds crazy
- admin for users - need good UX
- admin for DBAs/Support - don't want complaints and endless support requests
- web services API simplicity / complexity using Spring Data REST - HAL
I'd like to go with the more complex solution since it is unlikely to require re-working in the future, but I'm a bit concerned about both performance and the admin tasks involved in the UI to allow users to manage it.
A utopian solution would be a third-party Java-based webapp providing a user interface to allow admin.
EDIT: interesting to see other people tackling the same problem: Authorisation in microservices - how to approach domain object or entity level access control using ACL?