cancel
Showing results for 
Search instead for 
Did you mean: 

Rights-Mamangement on Process-Definitions

b_schnarr
Champ in-the-making
Champ in-the-making
Hello at all,

lets say I model a new process in the Activiti modeler or in eclipse. Is it possible to define which user or which user groups can see and start this new process definition after the deployment?

Thanks and best regards
Ben
12 REPLIES 12

frederikherema1
Star Contributor
Star Contributor
This is possible by using the API. After deployment, you can add candidate starters for a certain process-definition (using repositoryService). Later on, when you want to display the possible processDefinitions, use the startableByUser(…) on ProcessDefinitionQuery to limit the visibility of definitions.

Please note that the engine does NOT enforce this constraint, its more of a convenience offered to apps building on top of activiti engine.

b_schnarr
Champ in-the-making
Champ in-the-making
Thanks for your reply. I assume that this is not valid for the activiti explorer? So all users can see and start all available processes in the explorer?

frederikherema1
Star Contributor
Star Contributor
Yes, activiti explorer doesn't take those values into account

b_schnarr
Champ in-the-making
Champ in-the-making
I saw that the repositoryService in REST API is only available in the legacy REST API. In the new REST API, you can use the GET-Method repository/process-definitions and parametrize the query with startableByUser, e.g.
http://host-ip/activiti-rest/service/repository/process-definitions?startableByUser=kermit.
Ok, understood. Is it possible to set these permissions in the activiti explorer, too? What must I change in the code that the explorer only shows processes the user is allowed to see?

Thanks for your answer and best regards
Ben

trademak
Star Contributor
Star Contributor
Hi,

The process definition list should be using a query that takes into account the startableByUser option as available on the ProcessDefinitionQuery.

Best regards,

b_schnarr
Champ in-the-making
Champ in-the-making
Could you give me a hint in which classes I can find those queries? That would be great.

Thanks and best regards
Ben

b_schnarr
Champ in-the-making
Champ in-the-making
I checked out the whole project in eclipse and changed a few lines of code in the activiti-explorer module. Afterwoods, I created a new war file: right-click on the pom.xml of the activiti-webapp-explorer2, run-as –> maven build, goals: package. The generation of the war-file is successfull. You can read this:

<code>
[INFO] Scanning for projects…
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.activiti:activiti-webapp-explorer2:war:5.15-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.zeroturnaround:jrebel-maven-plugin is missing. @ line 38, column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]                                                                        
[INFO] ————————————————————————
[INFO] Building Activiti - Webapp - Explorer V2 5.15-SNAPSHOT
[INFO] ————————————————————————
[INFO]
[INFO] — maven-enforcer-plugin:1.0:enforce (enforce-maven) @ activiti-webapp-explorer2 —
[INFO]
[INFO] — maven-resources-plugin:2.5:resources (default-resources) @ activiti-webapp-explorer2 —
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 28 resources
[INFO]
[INFO] — jrebel-maven-plugin:1.1.5:generate (generate-rebel-xml) @ activiti-webapp-explorer2 —
[INFO]
[INFO] — maven-compiler-plugin:2.3.2:compile (default-compile) @ activiti-webapp-explorer2 —
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] — maven-resources-plugin:2.5:testResources (default-testResources) @ activiti-webapp-explorer2 —
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\schnarr\Desktop\Activiti\Activiti\modules\activiti-webapp-explorer2\src\test\resources
[INFO]
[INFO] — maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ activiti-webapp-explorer2 —
[INFO] No sources to compile
[INFO]
[INFO] — maven-surefire-plugin:2.7.1:test (default-test) @ activiti-webapp-explorer2 —
[INFO] No tests to run.
[INFO] Surefire report directory: C:\Users\schnarr\Desktop\Activiti\Activiti\modules\activiti-webapp-explorer2\target\surefire-reports

——————————————————-
T E S T S
——————————————————-
There are no tests to run.

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] — maven-war-plugin:2.1.1:war (default-war) @ activiti-webapp-explorer2 —
[INFO] Packaging webapp
[INFO] Assembling webapp [activiti-webapp-explorer2] in [C:\Users\schnarr\Desktop\Activiti\Activiti\modules\activiti-webapp-explorer2\target\activiti-webapp-explorer2-5.15-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\schnarr\Desktop\Activiti\Activiti\modules\activiti-webapp-explorer2\src\main\webapp]
[INFO] Webapp assembled in [11468 msecs]
[INFO] Building war: C:\Users\schnarr\Desktop\Activiti\Activiti\modules\activiti-webapp-explorer2\target\activiti-webapp-explorer2-5.15-SNAPSHOT.war
[WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored
(webxml attribute is missing from war task, or ignoreWebxml attribute is specified as 'true')
[INFO] ————————————————————————
[INFO] BUILD SUCCESS
[INFO] ————————————————————————
[INFO] Total time: 26.918s
[INFO] Finished at: Wed Feb 12 18:51:00 CET 2014
[INFO] Final Memory: 15M/219M
[INFO] ————————————————————————
</code>

But when I deploy the app on tomcat, I get the following error:

<code>
HTTP Status 500 - org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'explorerApp' defined in ServletContext resource [/WEB-INF/activiti-ui-context.xml]: Cannot resolve reference to bean 'formPropertyRendererManager' while setting bean property 'formPropertyRendererManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'formPropertyRendererManager' defined in ServletContext resource [/WEB-INF/activiti-ui-context.xml]: Cannot create inner bean 'org.activiti.explorer.ui.form.DoubleFormPropertyRenderer#5de3dfa4' of type [org.activiti.explorer.ui.form.DoubleFormPropertyRenderer] while setting bean property 'propertyRenderers' with key [3]; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.activiti.explorer.ui.form.DoubleFormPropertyRenderer] for bean with name 'org.activiti.explorer.ui.form.DoubleFormPropertyRenderer#5de3dfa4' defined in ServletContext resource [/WEB-INF/activiti-ui-context.xml]; nested exception is java.lang.ClassNotFoundException: org.activiti.explorer.ui.form.DoubleFormPropertyRenderer
</code>

I only added one if-Statement in one class and nothing else. All other sources and dependancies are the same as in the Git-Repos. Did I miss something?

Thank you very much

b_schnarr
Champ in-the-making
Champ in-the-making
The same result without any source code changes. I checked out the git project (master) in eclipse and builded the war of the activiti-webapp-explorer2 by right-klicking of the pom.xml–>Run as–>Maven build–>goals: package. When I try to open the login page, I get the mentioned error.

Thanks for your help and best regards
Ben

b_schnarr
Champ in-the-making
Champ in-the-making
My operations in detail with eclipse Kepler:

1.) File –> Import –> Git –> Projects from Git –> Clone URI
2.) URI : https://github.com/Activiti/Activiti; Host: github.com, Respo Path: /Activiti/Activiti
3.) Branch Selection: master, clone submodules
4.) Import as general project

Now, the project is available in eclipse without any errors.

5.) Right click on the project –> Configure –> Convert to maven project

Now, the project is correctly recognized as a maven project without any errors.

6.) Right click on project –> Maven –> Update Project

7.) Right click on pom.xml of the main project –> Run As –> Maven build; Goal: package

You can see this:

<code>
Results :

Tests run: 1290, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] — maven-jar-plugin:2.3.2:jar (default-jar) @ activiti-engine —
[INFO] Building jar: C:\Users\schnarr\Desktop\a13\Activiti\modules\activiti-engine\target\activiti-engine-5.15-SNAPSHOT.jar
[INFO] ————————————————————————
[INFO] Reactor Summary:
[INFO]
[INFO] Activiti …………………………………… SUCCESS [1.046s]
[INFO] Activiti - BPMN Model ……………………….. SUCCESS [6.945s]
[INFO] Activiti - BPMN Converter ……………………. SUCCESS [8.290s]
[INFO] Activiti - Engine …………………………… SUCCESS [4:08.162s]
[INFO] ————————————————————————
[INFO] BUILD SUCCESS
[INFO] ————————————————————————
[INFO] Total time: 4:25.678s
[INFO] Finished at: Thu Feb 13 13:04:00 CET 2014
[INFO] Final Memory: 46M/605M
[INFO] ————————————————————————
</code>

Now, right-click of the pom.xml of the activiti-webapp-explorer2–> Run As –> Maven build; Goals: package

You can see:

<code>
[INFO] Scanning for projects…
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.activiti:activiti-webapp-explorer2:war:5.15-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.zeroturnaround:jrebel-maven-plugin is missing. @ line 38, column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]                                                                        
[INFO] ————————————————————————
[INFO] Building Activiti - Webapp - Explorer V2 5.15-SNAPSHOT
[INFO] ————————————————————————
[INFO]
[INFO] — maven-enforcer-plugin:1.0:enforce (enforce-maven) @ activiti-webapp-explorer2 —
[INFO]
[INFO] — maven-resources-plugin:2.5:resources (default-resources) @ activiti-webapp-explorer2 —
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 28 resources
[INFO]
[INFO] — jrebel-maven-plugin:1.1.5:generate (generate-rebel-xml) @ activiti-webapp-explorer2 —
[INFO] Processing org.activiti:activiti-webapp-explorer2 with packaging war
[INFO]
[INFO] — maven-compiler-plugin:2.3.2:compile (default-compile) @ activiti-webapp-explorer2 —
[INFO] Compiling 1 source file to C:\Users\schnarr\Desktop\a13\Activiti\modules\activiti-webapp-explorer2\target\classes
[INFO]
[INFO] — maven-resources-plugin:2.5:testResources (default-testResources) @ activiti-webapp-explorer2 —
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\schnarr\Desktop\a13\Activiti\modules\activiti-webapp-explorer2\src\test\resources
[INFO]
[INFO] — maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ activiti-webapp-explorer2 —
[INFO] No sources to compile
[INFO]
[INFO] — maven-surefire-plugin:2.7.1:test (default-test) @ activiti-webapp-explorer2 —
[INFO] No tests to run.
[INFO] Surefire report directory: C:\Users\schnarr\Desktop\a13\Activiti\modules\activiti-webapp-explorer2\target\surefire-reports

——————————————————-
T E S T S
——————————————————-
There are no tests to run.

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] — maven-war-plugin:2.1.1:war (default-war) @ activiti-webapp-explorer2 —
[INFO] Packaging webapp
[INFO] Assembling webapp [activiti-webapp-explorer2] in [C:\Users\schnarr\Desktop\a13\Activiti\modules\activiti-webapp-explorer2\target\activiti-webapp-explorer2-5.15-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\schnarr\Desktop\a13\Activiti\modules\activiti-webapp-explorer2\src\main\webapp]
[INFO] Webapp assembled in [15365 msecs]
[INFO] Building war: C:\Users\schnarr\Desktop\a13\Activiti\modules\activiti-webapp-explorer2\target\activiti-webapp-explorer2-5.15-SNAPSHOT.war
[WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored
(webxml attribute is missing from war task, or ignoreWebxml attribute is specified as 'true')
[INFO] ————————————————————————
[INFO] BUILD SUCCESS
[INFO] ————————————————————————
[INFO] Total time: 33.121s
[INFO] Finished at: Thu Feb 13 13:07:30 CET 2014
[INFO] Final Memory: 25M/340M
[INFO] ————————————————————————
</code>

After the deployment on tomcat, I open the following URL: http://post-ip:8080/activiti-webapp-explorer2-5.15-SNAPSHOT/ui/

Then, I get the following error:

<code>
HTTP Status 500 - org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'explorerApp' defined in ServletContext resource [/WEB-INF/activiti-ui-context.xml]: Cannot resolve reference to bean 'formPropertyRendererManager' while setting bean property 'formPropertyRendererManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'formPropertyRendererManager' defined in ServletContext resource [/WEB-INF/activiti-ui-context.xml]: Cannot create inner bean 'org.activiti.explorer.ui.form.DoubleFormPropertyRenderer#e8c237f' of type [org.activiti.explorer.ui.form.DoubleFormPropertyRenderer] while setting bean property 'propertyRenderers' with key [3]; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.activiti.explorer.ui.form.DoubleFormPropertyRenderer] for bean with name 'org.activiti.explorer.ui.form.DoubleFormPropertyRenderer#e8c237f' defined in ServletContext resource [/WEB-INF/activiti-ui-context.xml]; nested exception is java.lang.ClassNotFoundException: org.activiti.explorer.ui.form.DoubleFormPropertyRenderer
</code>

Thank you for your help and best regards
Ben