Пример #1
0
    def Run(self, args):
        messages = folders.FoldersMessages()
        policy = iam_util.ParsePolicyFile(args.policy_file, messages.Policy)
        update_mask = iam_util.ConstructUpdateMaskFromPolicy(args.policy_file)

        # To preserve the existing set-iam-policy behavior of always overwriting
        # bindings and etag, add bindings and etag to update_mask.
        if 'bindings' not in update_mask:
            update_mask += ',bindings'
        if 'etag' not in update_mask:
            update_mask += ',etag'

        result = folders.SetIamPolicy(args.id, policy, update_mask)
        iam_util.LogSetIamPolicy(args.id, 'folder')
        return result
Пример #2
0
    def Run(self, args):
        messages = folders.FoldersMessages()
        policy, update_mask = iam_util.ParsePolicyFileWithUpdateMask(
            args.policy_file, messages.Policy)
        policy.version = iam_util.MAX_LIBRARY_IAM_SUPPORTED_VERSION

        # To preserve the existing set-iam-policy behavior of always overwriting
        # bindings and etag, add bindings and etag to update_mask.
        if 'bindings' not in update_mask:
            update_mask += ',bindings'
        if 'etag' not in update_mask:
            update_mask += ',etag'

        result = folders.SetIamPolicy(args.id, policy, update_mask)
        iam_util.LogSetIamPolicy(args.id, 'folder')
        return result
 def Run(self, args):
   policy = folders.GetIamPolicy(args.id)
   iam_util.RemoveBindingFromIamPolicy(policy, args.member, args.role)
   return folders.SetIamPolicy(args.id, policy)
 def Run(self, args):
   messages = folders.FoldersMessages()
   policy = folders.GetIamPolicy(args.id)
   iam_util.AddBindingToIamPolicy(
       messages.Binding, policy, args.member, args.role)
   return folders.SetIamPolicy(args.id, policy)
Пример #5
0
 def Run(self, args):
     messages = folders.FoldersMessages()
     policy = iam_util.ParsePolicyFile(args.policy_file, messages.Policy)
     return folders.SetIamPolicy(args.id, policy)