Aller au contenu principal

Set workflow permissions for groups on root or folder via api

Commentaires

6 commentaires

  • Zendesk API User
    Author: mseyfarth - 8/3/2020 16:24

    Hello E-spirit,

    I have exactly the same behavior like ncbruckner​.

    At the point of store.save() all information are lost and store.getWorkflowPermissions() returns an empty list.

    Is there a solution?

    Best regards

    Matthias

    0
  • Zendesk API User
    Author: ncbruckner - 8/4/2020 7:24

    Hi Matthias,

    I didn't find one. In the end I went through all the projects and set the check marks and afterwards ran my script. That still saved me some time when going through 30 something projects but it's only a workaround and not a particularly satisfying one either.

    Best regards,

    Nina

    0
  • Zendesk API User
    Author: mseyfarth - 8/4/2020 7:44

    Hi Nina-Christine,

    thanks for that - not good - information.

    I have to go through ~90 projects.

    As long as the API does not work as expected i think I have to do it manually too. :/

    Best regards,

    Matthias

    0
  • Zendesk API User
    Author: hoebbel - 8/6/2020 7:42

    Hi all,

    this behavior is probably a bug. It seems that the workflow permissions can only be set if the corresponding permission object already exists.

    Contact our TechSupport if you would like to be actively informed when this has been resolved or check the future FirstSpirit release notes for the ID "CORE-12618".

    Best regards,

    Holger

    0
  • Zendesk API User
    Author: mseyfarth - 8/6/2020 9:53

    Hello Holger,

    i already opend a bug report in TechSupport

    Thank you for the Ticket ID.

    Best regards,

    Matthias

    0
  • Zendesk API User
    Author: mseyfarth - 2/16/2021 8:21

    Hello everyone,

    the TechSupport answered.

    You need to add the following line:

    store.setInheritWorkflowPermission(false);

    It seems that you need to break the Inheritance.

    The following script sets a permission on a folder.

    Full example:

    import de.espirit.firstspirit.access.store.Store;

    userService = context.getUserService();

    pageStoreFolder = context.getElement();

    pageStoreFolder.setLock(true, false);

    workflow = userService.getStore(Store.Type.TEMPLATESTORE, true, false).getWorkflowByName("release");

    wfpermission = pageStoreFolder.getCreateWorkflowPermission(workflow);

    group = context.project.getGroups().get(0);

    wfpermission.allowGroup(group);

    pageStoreFolder.setWorkflowPermission(wfpermission);

    pageStoreFolder.setInheritWorkflowPermission(false);

    pageStoreFolder.save("Saved Workflow rights", false);

    pageStoreFolder.setLock(false, false);

    Best regards

    Matthias

    0

Vous devez vous connecter pour laisser un commentaire.