kalyan kumar kalvagadda created SENTRY-2242:
-----------------------------------------------

             Summary: Add schema changes to limit one one owner privilege per 
object
                 Key: SENTRY-2242
                 URL: https://issues.apache.org/jira/browse/SENTRY-2242
             Project: Sentry
          Issue Type: Sub-task
          Components: Sentry
    Affects Versions: 2.1.0
            Reporter: kalyan kumar kalvagadda
            Assignee: kalyan kumar kalvagadda


Currently user<-> privileges is implemented to handle privileges to owners of 
the respective objects. There can not be more than one owner to single object 
(database/table) so restriction should be added either at the application or 
the database schema to prevent it from happening.

I feel schema change is the best way to do it for now as there is no plan to 
implement user privileges in near future. In future when user privileges 
feature is implemented this change could be reverted and restriction can be 
added at application.

*Current Schema:*
{noformat}
ALTER TABLE `SENTRY_USER_DB_PRIVILEGE_MAP`
  ADD CONSTRAINT `SENTRY_USER_DB_PRIVILEGE_MAP_PK` PRIMARY KEY 
(`USER_ID`,`DB_PRIVILEGE_ID`);
{noformat}
*Proposed Solution:*
{noformat}
ALTER TABLE `SENTRY_USER_DB_PRIVILEGE_MAP`
  ADD CONSTRAINT `SENTRY_USER_DB_PRIVILEGE_MAP_PK` PRIMARY KEY 
(`DB_PRIVILEGE_ID`);
{noformat}

With this change DB_PRIVILEGE_ID would be the primary key and this restrict 
same privilege  to be granted to another user.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to