3 Replies Latest reply on Feb 21, 2013 7:43 AM by Alexander Szostek

    job addPermission

      Is there a way to write a script to add multiple permissions to a job at once.  Currently I am using blcli_execute Job addPermision, and I am trying to add multiple permissions at once, but it will only add one at a time. and it returns the errror "a new version of this object has been saved since you last loaded it.  you must load the before can make changes to it.".

        • 1. Re: job addPermission
          Lazar NameToUpdate

          the reason you get the error is because you use the same job dbkey. The job is automatically saved after every addPermission execution, and therefore the dbkey changes. there doesn't seem to be a bulk add option available (BR, here's an idea for another script : )


          The following can be utilized to write a script where you do not have to save after every permission add for performance:


          getDBKeyByGroupAndName as you normally do, and then:

          Job findByDBKey $DBKey

          BlAcl addPermission NAMED_OBJECT=job $roleName1 $authName1

          BlAcl addPermission NAMED_OBJECT=job $roleName2 $authName2

          BlAcl addPermission NAMED_OBJECT=job $roleNameN $authNameN

          Utility setTargetObject job

          Job update NAMED_OBJECT=job


          note: may need "Utility setTargetObject job" after every addPermission, not sure.

          "Job update" is what saves the job once in the end

          1 of 1 people found this helpful
          • 2. Re: job addPermission
            Bill Robinson

            or you can do this:


            blcli_execute Job addPermission $jobKey RoleName1 AuthName1

            blcli_storeenv jobKey

            blcli_execute Job addPermission $jobKey RoleName1 AuthName2

            blcli_storeenv jobKey



            or do that in a while loop.  your problem is that you are not capturing the new job key after you add a permission to the job.

            • 3. Re: job addPermission

              thank you very much, this worked perfectley