oddgen / bitemp

Code generator to switch between non-temporal, uni-temporal and bi-temporal models while preserving data.
Apache License 2.0
4 stars 1 forks source link

Add granted roles to default roles when generating solution for mission roles #6

Closed PhilippSalvisberg closed 7 years ago

PhilippSalvisberg commented 7 years ago

If select_catalog_role is not found in session_roles the following solution is generated:

GRANT SELECT_CATALOG_ROLE TO «conn.metaData.userName»;

This is ok, but to ensure the resolution works also when the role is not defaulted, the following additional statement should be generated as well:

ALTER USER «conn.metaData.userName» DEFAULT ROLE select_catalog_role, ...;

the , ... represents the list of existing roles.

PhilippSalvisberg commented 7 years ago

Granting is not enough if column defrole in table sys.user$ is != 1. A simpler variant is to just execute the following:

ALTER USER «conn.metaData.userName» DEFAULT ALL.

However, in some cases this might change the intended behaviour on connect.