Securing all content by one criterion
To do so, use the permission attribute of
as follows:
android:permission="PERMISSION-NAME"
... >
...
Here, PERMISSION-NAME is a system permission or a permission you defined in the
element of the app. If you do it that way, the complete content of the provider
is accessible only to such clients that successfully acquired exactly this permission. More
precisely, any read or write access requires clients to have this permission. If you need
to distinguish between read permission and write permission, you can instead use the
readPermission and writePermission attributes. If you use a mixture, the more specific
attributes win.
permission = A ® writePermission = A, readPermission = A
permission = A, readPermission = B ® writePermission = A,
readPermission = B
permission = A, writePermission = B ® writePermission = B,
readPermission = A
permission = A, writePermission = B, readPermission = C ®
writePermission = B, readPermission = C
2.
Securing specific URI paths
By using the
subelement of
, you can impose
restrictions on specific URI paths.
android:pathPrefix="string"
android:pathPattern="string"
android:permission="string"
android:readPermission="string"
android:writePermission="string" />
In the *permission attributes, you specify the permission name and permission
scope, just as described earlier for securing all content by one criterion. For the
path specification, you use exactly one of the three possible attributes: path is
for an exact path match, path- Prefix is for matching the start of a path, and
pathPattern allows for wildcards (X* is for zero to many occurrences of any
character X, and .* is for zero to many occurrences of any character). Since
you can use several
elements, you can build a fine-grained
permission structure in your content provider.
Do'stlaringiz bilan baham: |