读书人

【通译】(52)grant-uri-permission元素

发布时间: 2012-07-30 16:19:05 作者: rapoo

【翻译】(52)grant-uri-permission元素

【翻译】(52)grant-uri-permission元素

?

see

http://developer.android.com/guide/topics/manifest/grant-uri-permission-element.html

?

原文见

http://developer.android.com/guide/topics/manifest/grant-uri-permission-element.html

?

-------------------------------

?

<grant-uri-permission>

?

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.

?

指定父内容提供者权限的哪个数据子集可以被授权。数据子集通过一个content: URI的路径部分来指定。(URI的权力部分标识内容提供者。)授权权限是使正常情况下没有权限访问其数据的提供者客户端能够在单次的基础上跨越那个限制的一种方式。

?

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).

?

如果一个内容提供者的grantUriPermissions属性为"true",那么权限可以对该提供者的范围下的任意数据授权。然而,如果那个属性为"false",那么权限可以只对这个元素指定的数据子集授权。一个提供者可以包含任意数量的<grant-uri-permission>元素。每个元素只可以指定一个路径(只是三种可能属性中的一种)。

?

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

?

想获得关于权限如何被授权的信息,请参见<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:

?

一个标识权限可以授权到的一个或多个数据子集的路径。path属性指定一个完整的路径;权限只可以授权给那个路径标识的特殊数据子集。pathPrefix属性指定路径的开始部分;权限可以授权给所有带有共享那个开始部分的路径的数据子集。pathPattern属性指定一个完整路径,但是它可以包含以下通配符:

?

* 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.

?

* 一个点后面跟着一个星号(".*")匹配0到多个字符的任意序列。

?

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.

?

因为'\'被用作一个转义字符当该字符串从XML中被读取(在它被解释为一个模式之前),你将需要双转义:例如,一个字面'*'应该被写成"\\*"而一个字面'\'应该被写成"\\\\"。这基本上和如果在Java代码中构造字符串的话你需要写的东西是相同的。

?

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

?

想获得关于这三种类型模式的更多信息,参见PatternMatcher类中PATTERN_LITERAL,PATTERN_PREFIX,和PATTERN_SIMPLE_GLOB的描述。

?

* introduced in:

?

* 引入:

?

API Level 1

?

API级别1

?

* see also:

?

* 另见:

?

the grantUriPermissions attribute of the <provider> element

?

<provider>元素的grantUriPermissions属性

?

Except as noted, this content is licensed under Apache 2.0. For details and restrictions, see the Content License.

?

除特别说明外,本文在Apache 2.0下许可。细节和限制请参考内容许可证。

?

Android 4.0 r1 - 10 Feb 2012 0:44

?

-------------------------------

?

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

?

(此页部分内容基于Android开源项目,以及使用根据创作公共2.5来源许可证描述的条款进行修改)

?

(本人翻译质量欠佳,请以官方最新内容为准,或者参考其它翻译版本:

* ソフトウェア技ドキュメントを手に翻

http://www.techdoctranslator.com/android

* Ley's Blog

http://leybreeze.com/blog/

* 农民伯伯

http://www.cnblogs.com/over140/

* Android中文翻译组

http://androidbox.sinaapp.com/


读书人网 >移动开发

热点推荐