> On Nov. 10, 2014, 4:20 p.m., Lenni Kuff wrote:
> > sentry-core/sentry-core-common/src/main/java/org/apache/sentry/core/common/utils/PathUtils.java,
> >  line 125
> > <https://reviews.apache.org/r/27512/diff/2/?file=748178#file748178line125>
> >
> >     I'm not sure how the Path class doesn't do all of this work for you. 
> > You may still need this function, but I think nearly all the logic can get 
> > pushed into the Path/URI classes. See example test case below.
> >     
> >     I think it would also be desireable if we supported URIs outside of the 
> > warehouse filesystem. Basically:
> >     1) If the URI is qualified with a schema and authority, use it as-is.
> >     2) If it is not qualified, copy the scheme/auth from the warehouse.
> >     
> >     
> >     Path path = new Path("swift://namenode:8080/path/to/warehouse");
> >         Assert.assertEquals(false, path.isAbsoluteAndSchemeAuthorityNull());
> >         Assert.assertEquals("swift", path.toUri().getScheme());
> >         Assert.assertEquals("namenode:8080", path.toUri().getAuthority());
> >         Assert.assertEquals("/path/to/warehouse",
> >                 Path.getPathWithoutSchemeAndAuthority(path).toString());
> >         Path pathNoSchemeOrAuth = new Path("/path/to/warehouse/a/b");
> >         Assert.assertEquals(true, 
> > pathNoSchemeOrAuth.isAbsoluteAndSchemeAuthorityNull());
> >         
> >         // If the URI wasn't qualified with a scheme and authority, use the 
> > one from the
> >         // warehouse directory.
> >         Path hdfsPath = new Path("hdfs://namenode:8080/path/to/warehouse");
> >         pathNoSchemeOrAuth = pathNoSchemeOrAuth.makeQualified(
> >                 hdfsPath.toUri(), hdfsPath);
> >         Assert.assertEquals("hdfs", pathNoSchemeOrAuth.toUri().getScheme());
> >         Assert.assertEquals(false, 
> > pathNoSchemeOrAuth.isAbsoluteAndSchemeAuthorityNull());
> >         Assert.assertEquals("/path/to/warehouse/a/b",
> >                 
> > Path.getPathWithoutSchemeAndAuthority(pathNoSchemeOrAuth).toString());

Thanks for your example, the logic is updated according to the Path.
Also Thanks for your time to review.


- Colin


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/27512/#review60611
-----------------------------------------------------------


On Nov. 4, 2014, 6:46 a.m., Colin Ma wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/27512/
> -----------------------------------------------------------
> 
> (Updated Nov. 4, 2014, 6:46 a.m.)
> 
> 
> Review request for sentry and Prasad Mujumdar.
> 
> 
> Repository: sentry
> 
> 
> Description
> -------
> 
> Currently the URI privilege validation assumes that the filesystem prefixes 
> can be 'file:' or 'hdfs:'. We should make this more generic to support other 
> prefixes available in the underlying filesystem.
> 
> 
> Diffs
> -----
> 
>   
> sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/HiveAuthzBindingHook.java
>  f94ae7c 
>   
> sentry-core/sentry-core-common/src/main/java/org/apache/sentry/core/common/utils/PathUtils.java
>  1cdbdb8 
>   
> sentry-core/sentry-core-common/src/test/java/org/apache/sentry/core/common/utils/TestPathUtils.java
>  d30305b 
> 
> Diff: https://reviews.apache.org/r/27512/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Colin Ma
> 
>

Reply via email to