<grant-uri-permission>

syntax:
<grant-uri-permission android:path="string"
                      android:pathPattern="string"
                      android:pathPrefix="string" />
contained in:
<provider>
description:
Specifies which data subsets of the parent content provider permission can be granted for. Data subsets are indicated by the path part of a content: URI. (The authority part of the URI identifies the content provider.) Granting permission is a way of enabling clients of the provider that don't normally have permission to access its data to overcome that restriction on a one-time basis.

If a content provider's grantUriPermissions attribute is "true", permission can be granted for any the data under the provider's purview. However, if that attribute is "false", permission can be granted only to data subsets that are specified by this element. A provider can contain any number of <grant-uri-permission> elements. Each one can specify only one path (only one of the three possible attributes).

For information on how permission is granted, see the <intent-filter> element's grantUriPermissions attribute.

부모parent 컨텐트 프로바이더 퍼미션이 부여될 수 있는 데이터 서브셋subset을 지정한다. 데이터 서브셋subset은 content: URI(URI의 권위(authority) 영역은 컨텐트 프로바이더에 대한 식별자이다)의 경로path의 일부분을 가리킨다. 퍼미션을 부여하는grant 것은 일반적으로 컨텐트 프로바이더의 데이터에 대한 접근 퍼미션을 가지지 않은 클라이언트에게 한 번은 그 제약을 극복하게 하는 것을 가능하게 하는 방법이다.

만약 컨텐트 프로바이더의 grantUriPermissions 애트리뷰트가 “참true”이라면, 퍼미션은 프로바이더 영역 안의 어떤 데이터에 대해서도 부여될 수 있다. 하지만 만약 그 애트리뷰트가 “거짓false”이라면, 퍼미션은 이 엘리먼트에 의해 지정된 데이터 서브셋subset에 한해서만 부여될 수 있다. 프로바이더는 임의의 개수의 <grant-uri-permission> 엘리먼트를 포함할 수 있다. 각각은 오직 하나의 경로path (세 개의 가능한 애트리뷰트 중 오직 한 개)만 지정할 수 있다.

퍼미션을 부여하는 방법에 관한 정보에 대해서는, <intent-filter> 엘리먼트의 grantUriPermissions 애트리뷰트를 보라.

attributes:
android:path
android:pathPrefix
android:pathPattern
A path identifying the data subset or subsets that permission can be granted for. The path attribute specifies a complete path; permission can be granted only to the particular data subset identified by that path. The pathPrefix attribute specifies the initial part of a path; permission can be granted to all data subsets with paths that share that initial part. The pathPattern attribute specifies a complete path, but one that can contain the following wildcards:
  • An asterisk ('*') matches a sequence of 0 to many occurrences of the immediately preceding character.
  • A period followed by an asterisk (".*") matches any sequence of 0 to many characters.

Because '\' is used as an escape character when the string is read from XML (before it is parsed as a pattern), you will need to double-escape: For example, a literal '*' would be written as "\\*" and a literal '\' would be written as "\\\\". This is basically the same as what you would need to write if constructing the string in Java code.

For more information on these types of patterns, see the descriptions of PATTERN_LITERAL, PATTERN_PREFIX, and PATTERN_SIMPLE_GLOB in the PatternMatcher class.

퍼미션이 부여될 수 있는 데이터 서브셋subset 또는 서브셋subset들을 구분하는 경로path. 경로path 애트리뷰트는 전체 경로path를 지정한다; 퍼미션은 그 경로path에 의해 구분되는 특정 데이터 서브셋subset에게만 부여될 수 있다. pathPrefix 애트리뷰트는 경로path의 첫 머리 부분을 지정한다; 퍼미션은 그 첫 머리 부분을 공유하는 경로들paths을 가지는 모든 데이터 서브셋subset들에 부여될 수 있다. pathPattern 애트리뷰트는 전체 경로path를 지정하지만, 그것은 다음과 같은 와일드카드를 포함할 수 있다.
  • 별표(‘*’)는 바로 앞에 나오는 문자가 0번 이상 발생하는 것을 나타낸다.
  • 별표가 마침표 뒤에 나오는 것(“.*”)은 어떤 문자든 0번 이상 발생하는 것을 나타낸다.

문자열이 XML로부터 읽어질 때(그것이 패턴으로써 분석되기 전에) “\”는 이스케이프escape 문자로써 사용되기 때문에, 여러분은 두 개의 이스케이프escape가 필요할 것이다.: 예를 들어 글자 그대로인 ‘*’는 “\\*”로 작성되어질 것이고, 글자 그대로인 ‘\’는 “\\\\”로 작성되어질 것이다. 이것은 여러분이 만약 Java 코드 안에서 문자열을 만들 때 작성할 필요가 있는 것과 기본적으로 같다.

이러한 세 가지 타입의 패턴에 대한 더 많은 정보에 대해서는, PatternMatcher 클래스 안의 PATTERN_LITERAL, PATTERN_PREFIX, 그리고 PATTERN_SIMPLE_GLOB에 대한 설명을 보라.

introduced in:
API Level 1
see also:
the grantUriPermissions attribute of the <provider> element
↑ Go to top