Custom policies can be created to supplement the system-defined policies of OBS.
For details, see Creating a Custom Policy. The following provides examples of common OBS custom policies.
This policy allows users to perform all operations on OBS Console.
{
"Version": "1.1",
"Statement": [
{
"Effect": "Allow",
"Action": [
"obs:*:*"
]
}
]
}
{
"Version": "1.1",
"Statement": [
{
"Effect": "Allow",
"Action": [
"obs:object:GetObject",
"obs:bucket:ListBucket"
],
"Resource": [
"obs:*:*:object:obs-example/my-project/*",
"obs:*:*:bucket:obs-example"
]
}
]
}
{
"Version": "1.1",
"Statement": [
{
"Effect": "Allow",
"Action": [
"obs:object:GetObject",
"obs:object:ListMultipartUploadParts",
"obs:bucket:ListBucket",
"obs:object:DeleteObject",
"obs:object:PutObject"
],
"Resource": [
"obs:*:*:object:obs-example/my-project/*",
"obs:*:*:bucket:obs-example"
]
}
]
}
A deny policy must be used together with other policies. If the permissions assigned to a user contain both "Allow" and "Deny", the "Deny" permissions take precedence over the "Allow" permissions.
If you grant the system policy OBS OperateAccess to a user but do not want the user to have the object upload permission (which is also a permission allowed by OBS OperateAccess), you can create a custom policy besides the OBS OperateAccess policy, to deny the user's upload permission. According to the authorization principle, the policy with the deny statement takes precedence, so that the user can perform all operations allowed by OBS OperateAccess, except uploading objects. The following is an example of a deny policy:
{
"Version": "1.1",
"Statement": [
{
"Effect": "Deny",
"Action": [
"obs:object:PutObject"
]
}
]
}