def GrantCronJobApproval(self, cron_job_id, requestor=None, approval_id=None, approver="approver", admin=True): """Grants an approval for a given cron job.""" if not requestor: requestor = self.token.username if not approval_id: raise ValueError("approval_id can't be empty.") self.CreateUser(requestor) if admin: self.CreateAdminUser(approver) else: self.CreateUser(approver) args = api_user.ApiGrantCronJobApprovalArgs(cron_job_id=cron_job_id, username=requestor, approval_id=approval_id) handler = api_user.ApiGrantCronJobApprovalHandler() handler.Handle(args, token=access_control.ACLToken(username=approver))
def GrantCronJobApproval(self, args, token=None): return api_user.ApiGrantCronJobApprovalHandler()