sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject git commit: SENTRY-138 - Use server timestamp for createTime for role, privilege and group (Shreepadma via Brock)
Date Mon, 31 Mar 2014 20:30:43 GMT
Repository: incubator-sentry
Updated Branches:
  refs/heads/master a6821a611 -> 97e91887d


SENTRY-138 - Use server timestamp for createTime for role, privilege and group (Shreepadma
via Brock)


Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/97e91887
Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/97e91887
Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/97e91887

Branch: refs/heads/master
Commit: 97e91887d33a2bf1f4e5b89d15ef661098317da4
Parents: a6821a6
Author: Brock Noland <brock@apache.org>
Authored: Mon Mar 31 13:30:03 2014 -0700
Committer: Brock Noland <brock@apache.org>
Committed: Mon Mar 31 13:30:03 2014 -0700

----------------------------------------------------------------------
 .../sentry/provider/db/service/model/package.jdo    | 16 ++++++++--------
 .../provider/db/service/persistent/SentryStore.java |  5 +++--
 2 files changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/97e91887/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/package.jdo
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/package.jdo
b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/package.jdo
index 03f7549..9d68dbf 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/package.jdo
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/package.jdo
@@ -27,7 +27,7 @@
 -->
 <jdo>  
   <package name="org.apache.sentry.provider.db.service.model">  
-    <class name="MSentryGroup" identity-type="datastore" table="SENTRY_GROUPS" detachable="true">
 
+    <class name="MSentryGroup" identity-type="datastore" table="SENTRY_GROUP" detachable="true">
 
       <datastore-identity>
         <column name="GROUP_ID"/>
       </datastore-identity>
@@ -48,13 +48,13 @@
         
     </class>
     
-    <class name="MSentryRole" identity-type="datastore" table="SENTRY_ROLES" detachable="true">
 
+    <class name="MSentryRole" identity-type="datastore" table="SENTRY_ROLE" detachable="true">
 
       <datastore-identity>
         <column name="ROLE_ID"/>
       </datastore-identity>
       <field name="roleName">  
         <column name="ROLE_NAME" length="128" jdbc-type="VARCHAR"/>
-        <index name="SentryRoleNaME" unique="true"/>
+        <index name="SentryRoleName" unique="true"/>
       </field>
       <field name = "createTime">
       	<column name = "CREATE_TIME" jdbc-type="BIGINT"/>
@@ -62,17 +62,17 @@
       <field name="grantorPrincipal">  
         <column name="GRANTOR_PRINCIPAL" length="4000" jdbc-type="VARCHAR"/>
       </field>
-      <field name = "privileges" table="ROLES_PRIVILEGES" >
+      <field name = "privileges" table="SENTRY_ROLE_DB_PRIVILEGE_MAP" >
         <collection element-type="org.apache.sentry.provider.db.service.model.MSentryPrivilege"/>
             <join>
                 <column name="ROLE_ID"/>
             </join>
             <element>
-                <column name="PRIVILEGE_ID"/>
+                <column name="DB_PRIVILEGE_ID"/>
             </element>
       </field>  
       
-      <field name = "groups" table="ROLES_GROUPS" >
+      <field name = "groups" table="SENTRY_ROLE_GROUP_MAP" >
         <collection element-type="org.apache.sentry.provider.db.service.model.MSentryGroup"/>
             <join>
                 <column name="ROLE_ID"/>
@@ -83,9 +83,9 @@
       </field>  
     </class>
     
-    <class name="MSentryPrivilege" identity-type="datastore" table="SENTRY_PRIVILEGES"
detachable="true">  
+    <class name="MSentryPrivilege" identity-type="datastore" table="SENTRY_DB_PRIVILEGE"
detachable="true">  
       <datastore-identity>
-        <column name="PRIVILEGE_ID"/>
+        <column name="DB_PRIVILEGE_ID"/>
       </datastore-identity>
       <field name="privilegeName">  
         <column name="PRIVILEGE_NAME" length="128" jdbc-type="VARCHAR"/>

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/97e91887/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
index aca1350..ac6c6f7 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
@@ -614,7 +614,8 @@ public class SentryStore {
 
   /**
    * Converts thrift object to model object. Additionally does normalization
-   * such as trimming whitespace and setting appropriate case.
+   * such as trimming whitespace and setting appropriate case. Also sets the create
+   * time.
    */
   private MSentryRole convertToMSentryRole(String roleName, String grantorPrincipal) {
     MSentryRole mRole = new MSentryRole();
@@ -666,7 +667,7 @@ public class SentryStore {
     mSentryPrivilege.setTableName(safeTrim(privilege.getTableName()));
     mSentryPrivilege.setPrivilegeScope(safeTrim(privilege.getPrivilegeScope()));
     mSentryPrivilege.setAction(safeTrim(privilege.getAction()));
-    mSentryPrivilege.setCreateTime(privilege.getCreateTime());
+    mSentryPrivilege.setCreateTime(System.currentTimeMillis());
     mSentryPrivilege.setGrantorPrincipal(safeTrim(privilege.getGrantorPrincipal()));
     mSentryPrivilege.setURI(safeTrim(privilege.getURI()));
     mSentryPrivilege.setPrivilegeName(constructPrivilegeName(privilege));


Mime
View raw message