All Downloads are FREE. Search and download functionalities are using the official Maven repository.

petriNets.engine-processes.impersonation_config.xml Maven / Gradle / Ivy

Go to download

System provides workflow management functions including user, role and data management.

There is a newer version: 6.3.3
Show newest version
<document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://petriflow.com/petriflow.schema.xsd">
	<id>impersonation_config</id>
	<version>1.0.0</version>
	<initials>IPC</initials>
	<title name="caseName">Impersonators configuration</title>
	<icon>supervisor_account</icon>
	<defaultRole>false</defaultRole>
	<anonymousRole>false</anonymousRole>
	<transitionRole>false</transitionRole>
	<caseName name="caseName">Impersonators configuration</caseName>

	<function scope="process" name="validateUser">
		{ String ownerId ->
			def user = userService.loggedOrSystem
			def adminProcessRole = useCase.petriNet.roles.values().find { it.importId == "admin_imp" }
			if (user.stringId != ownerId &amp;&amp; !user.getProcessRoles().any { it.stringId == adminProcessRole.stringId }) {
				throw new IllegalArgumentException("User is not allowed to manipulate other users' impersonation configurations!")
			}
		}
	</function>

	<i18n locale="sk">
		<i18nString name="caseName">Konfigurácia zastupiteľov</i18nString>
		<i18nString name="role_user">Používateľ</i18nString>
		<i18nString name="impersonated_email">E-mail zastúpeného</i18nString>
		<i18nString name="impersonators">Nastavení zastupitelia</i18nString>
		<i18nString name="valid_from">Platnosť od</i18nString>
		<i18nString name="valid_to">Platnosť do</i18nString>
		<i18nString name="is_active">Aktívna konfigurácia</i18nString>
		<i18nString name="impersonated">Používateľ na zastúpenie</i18nString>
		<i18nString name="remove_impersonator">Vymazať označených</i18nString>
		<i18nString name="add_selected">Pridať vybraného</i18nString>
		<i18nString name="impersonated_authorities">Zastúpené autority</i18nString>
		<i18nString name="impersonated_roles">Zastúpené procesné roly</i18nString>
		<i18nString name="configure_impersonators">Výber zastupiteľov</i18nString>
		<i18nString name="deactivate">Deaktivovať</i18nString>
		<i18nString name="reactivate">Znovu aktivovať</i18nString>
		<i18nString name="publish">Publikovať</i18nString>
	</i18n>

	<i18n locale="de">
		<i18nString name="caseName">Vertreter Konfiguration</i18nString>
		<i18nString name="role_user">Benutzer</i18nString>
		<i18nString name="impersonated_email">E-Mail-Adresse des Vertreters</i18nString>
		<i18nString name="impersonators">Konfigurierte Vertreter</i18nString>
		<i18nString name="valid_from">Gültig ab</i18nString>
		<i18nString name="valid_to">Gültig bis</i18nString>
		<i18nString name="is_active">Aktive Konfiguration</i18nString>
		<i18nString name="impersonated">Benutzer zu vertreten</i18nString>
		<i18nString name="remove_impersonator">Ausgewählte löschen</i18nString>
		<i18nString name="add_selected">Ausgewählte hinzufügen</i18nString>
		<i18nString name="impersonated_authorities">Vertretene Berechtigungen</i18nString>
		<i18nString name="impersonated_roles">Vertretene Rollen</i18nString>
		<i18nString name="configure_impersonators">Vertreter auswählen</i18nString>
		<i18nString name="deactivate">Deaktivieren</i18nString>
		<i18nString name="reactivate">Reaktivieren</i18nString>
		<i18nString name="publish">Veröffentlichen</i18nString>
	</i18n>
	<roleRef>
		<id>admin_imp</id>
		<caseLogic>
			<create>true</create>
			<delete>true</delete>
			<view>true</view>
		</caseLogic>
	</roleRef>
	<roleRef>
		<id>user_imp</id>
		<caseLogic>
			<create>true</create>
			<view>true</view>
		</caseLogic>
	</roleRef>
	<roleRef>
		<id>default</id>
		<caseLogic>
			<view>true</view>
		</caseLogic>
	</roleRef>
	<userRef>
		<id>config_owner</id>
		<caseLogic>
			<delete>true</delete>
			<view>true</view>
		</caseLogic>
	</userRef>
	<caseEvents>
		<event type="create">
			<id>create</id>
			<actions phase="post">
				<action id="action_0">
					impersonated_email: f.impersonated_email,
                    impersonated: f.impersonated,
                    config_owner: f.config_owner;

					def user = userService.loggedOrSystem
					change impersonated value { new com.netgrif.application.engine.petrinet.domain.dataset.UserFieldValue(user.id, user.name, user.surname, user.email) }
					change impersonated_email value { user.email }

					change config_owner value { new com.netgrif.application.engine.petrinet.domain.dataset.UserListFieldValue([impersonated.value]) }
				</action>

				<action>
					user_select_caseId: f.user_select_caseId,
					user_select_taskRef: f.user_select_taskRef;

					def userSelectCase = createCase("impersonation_users_select")
					change user_select_taskRef value { [userSelectCase.tasks.find { it.transition == "select_user" }.task] }
					change user_select_caseId value { userSelectCase.stringId }

					setData((user_select_taskRef.value as List)[0], [
							"parentId": ["type": "text", "value": useCase.stringId]
					])
				</action>
			</actions>
		</event>
	</caseEvents>
	<role>
		<id>admin_imp</id>
		<title>Admin</title>
	</role>
	<role>
		<id>user_imp</id>
		<title name="role_user">User</title>
	</role>
	<data type="text" immediate="true">
		<id>impersonated_email</id>
		<title name="impersonated_email">Impersonated email</title>
		<event type="set">
			<id>impersonated_email_set</id>
		</event>
	</data>
	<data type="multichoice_map" immediate="true">
		<id>impersonators</id>
		<title name="impersonators">Configured impersonators</title>
		<component>
			<name>list</name>
		</component>

		<event type="set">
			<actions phase="pre">
				<action>
					impersonated: f.impersonated;

					validateUser(impersonated.value.id)
				</action>
			</actions>
		</event>
	</data>
	<data type="userList">
		<id>config_owner</id>
		<title/>
	</data>
	<data type="dateTime" immediate="true">
		<id>valid_from</id>
		<title name="valid_from">Valid from</title>

		<event type="set">
			<actions phase="pre">
				<action>
					impersonated: f.impersonated;

					validateUser(impersonated.value.id)
				</action>
			</actions>
		</event>
	</data>
	<data type="dateTime" immediate="true">
		<id>valid_to</id>
		<title name="valid_to">Valid until</title>

		<event type="set">
			<actions phase="pre">
				<action>
					impersonated: f.impersonated;

					validateUser(impersonated.value.id)
				</action>
			</actions>
		</event>
	</data>
	<data type="boolean" immediate="true">
		<id>is_active</id>
		<title name="is_active">Is active</title>

		<event type="set">
			<actions phase="pre">
				<action>
					impersonated: f.impersonated;

					validateUser(impersonated.value.id)
				</action>
			</actions>
		</event>
	</data>
	<data type="user" immediate="true">
		<id>impersonated</id>
		<title name="impersonated">User to impersonate</title>
		<event type="set">
			<id>impersonated_set</id>
			<actions phase="pre">
				<action>
					impersonated: f.impersonated;

					validateUser(impersonated.value.id)
				</action>
			</actions>
			<actions phase="post">
				<action id="action_1">
					impersonated_email: f.impersonated_email,
                    impersonated: f.impersonated;

                    change impersonated_email value { impersonated.value.email }</action>
			</actions>
		</event>
	</data>

	<data type="button">
		<id>remove_impersonator</id>
		<title/>
		<placeholder name="remove_impersonator">Remove selected</placeholder>
		<event type="set">
			<id>remove_impersonator_set</id>
			<actions phase="pre">
				<action>
					impersonated: f.impersonated;

					validateUser(impersonated.value.id)
				</action>
				<action id="action_2">
					impersonators: f.impersonators;

                    if (impersonators.value != null &amp;&amp; impersonators.options != null) {
						def options = impersonators.options
						def values = impersonators.value
						values.each { it -&gt; options.remove(it) }
						change impersonators value { null }
						change impersonators options { options }
                    }
				</action>
			</actions>
		</event>
	</data>
	<data type="button">
		<id>add_selected</id>
		<title/>
		<placeholder name="add_selected">Add selected</placeholder>
		<event type="set">
			<id>add_selected_set</id>
			<actions phase="pre">
				<action>
					impersonated: f.impersonated;

					validateUser(impersonated.value.id)
				</action>
				<action id="10">
					user_select_caseId: f.user_select_caseId,
					user_select_taskRef: f.user_select_taskRef,
					impersonators: f.impersonators;

					def userSelectCase = workflowService.findOne(user_select_caseId.value)
					def selectedUserField = userSelectCase.dataSet["select_impersonator"]

					if (!selectedUserField.value || !selectedUserField.options[selectedUserField.value]) {
						return
					}

					def options = impersonators.options != null ? impersonators.options : [:] as java.util.Map
					options.put(selectedUserField.value, selectedUserField.options[selectedUserField.value])
					options = options.sort { it.value }
					change impersonators options { options }
					change impersonators value { options.keySet() }

					setData((user_select_taskRef.value as List)[0], [
					        "select_impersonator": ["type": "enumeration_map", "value": ""]
					])
				</action>
			</actions>
		</event>
	</data>
	<data type="multichoice_map" immediate="true">
		<id>impersonated_authorities</id>
		<title name="impersonated_authorities">Impersonated authorities</title>

		<event type="set">
			<actions phase="pre">
				<action>
					impersonated: f.impersonated;

					validateUser(impersonated.value.id)
				</action>
			</actions>
		</event>
		<event type="get">
			<id>impersonated_authorities_get</id>

			<actions phase="post">
				<action>
					impersonated: f.impersonated,
					impersonated_authorities: f.impersonated_authorities;

					def impersonatedUser = userService.findById(impersonated.value.id, false)
					change impersonated_authorities options {
						impersonatedUser.authorities.collectEntries { [(it.stringId): (it.name)] }
					}
				</action>
			</actions>
		</event>
	</data>
	<data type="multichoice_map" immediate="true">
		<id>impersonated_roles</id>
		<title name="impersonated_roles">Impersonated roles</title>

		<event type="set">
			<actions phase="pre">
				<action>
					impersonated: f.impersonated;

					validateUser(impersonated.value.id)
				</action>
			</actions>
		</event>
		<event type="get">
			<id>impersonated_roles</id>

			<actions phase="post">
				<action>
					impersonated: f.impersonated,
					impersonated_roles: f.impersonated_roles;

					def impersonatedUser = userService.findById(impersonated.value.id, false)
					change impersonated_roles options {
						return impersonatedUser.processRoles.findAll { it.netId }.sort { it.netId }.collectEntries {
							def net = petriNetService.get(new org.bson.types.ObjectId(it.netId))
							return [(it.stringId): ("$it.name ($net.title $net.identifier-$net.version)" as String)]
						}
					}
				</action>
			</actions>
		</event>
	</data>
	<data type="taskRef">
		<id>user_select_taskRef</id>
		<title/>
	</data>
	<data type="text">
		<id>user_select_caseId</id>
		<title/>
	</data>
	<transition>
		<id>t2</id>
		<x>500</x>
		<y>180</y>
		<label name="configure_impersonators">Configure impersonators</label>
		<assignPolicy>auto</assignPolicy>
		<roleRef>
			<id>admin_imp</id>
			<logic>
				<view>true</view>
				<cancel>true</cancel>
				<assign>true</assign>
				<delegate>true</delegate>
				<perform>true</perform>
			</logic>
		</roleRef>
		<userRef>
			<id>config_owner</id>
			<logic>
				<view>true</view>
				<cancel>true</cancel>
				<assign>true</assign>
				<delegate>true</delegate>
				<perform>true</perform>
			</logic>
		</userRef>
		<dataGroup>
			<id>t2_0</id>
			<cols>4</cols>
			<layout>grid</layout>
			<dataRef>
				<id>impersonators</id>
				<logic>
					<behavior>editable</behavior>

				</logic>
				<layout>
					<x>0</x>
					<y>2</y>
					<rows>1</rows>
					<cols>2</cols>
					<template>material</template>
					<appearance>outline</appearance>
				</layout>
			</dataRef>
			<dataRef>
				<id>valid_from</id>
				<logic>
					<behavior>editable</behavior>
				</logic>
				<layout>
					<x>0</x>
					<y>4</y>
					<rows>1</rows>
					<cols>2</cols>
					<template>material</template>
					<appearance>outline</appearance>
				</layout>
			</dataRef>
			<dataRef>
				<id>valid_to</id>
				<logic>
					<behavior>editable</behavior>
				</logic>
				<layout>
					<x>2</x>
					<y>4</y>
					<rows>1</rows>
					<cols>2</cols>
					<template>material</template>
					<appearance>outline</appearance>
				</layout>
			</dataRef>
			<dataRef>
				<id>remove_impersonator</id>
				<logic>
					<behavior>editable</behavior>
				</logic>
				<layout>
					<x>2</x>
					<y>2</y>
					<rows>1</rows>
					<cols>2</cols>
					<template>material</template>
					<appearance>outline</appearance>
				</layout>
				<component>
					<name>stroked</name>
				</component>
			</dataRef>
			<dataRef>
				<id>add_selected</id>
				<logic>
					<behavior>editable</behavior>
				</logic>
				<layout>
					<x>2</x>
					<y>1</y>
					<rows>1</rows>
					<cols>2</cols>
					<template>material</template>
					<appearance>outline</appearance>
				</layout>
				<component>
					<name>stroked</name>
				</component>
			</dataRef>
			<dataRef>
				<id>impersonated_authorities</id>
				<logic>
					<behavior>editable</behavior>
				</logic>
				<layout>
					<x>2</x>
					<y>3</y>
					<rows>1</rows>
					<cols>2</cols>
					<template>material</template>
					<appearance>outline</appearance>
				</layout>

				<component>
					<name>list</name>
				</component>
			</dataRef>
			<dataRef>
				<id>impersonated_roles</id>
				<logic>
					<behavior>editable</behavior>
				</logic>
				<layout>
					<x>0</x>
					<y>3</y>
					<rows>1</rows>
					<cols>2</cols>
					<template>material</template>
					<appearance>outline</appearance>
				</layout>
				<component>
					<name>list</name>
				</component>
			</dataRef>
			<dataRef>
				<id>user_select_taskRef</id>
				<logic>
					<behavior>editable</behavior>
				</logic>
				<layout>
					<x>0</x>
					<y>0</y>
					<rows>1</rows>
					<cols>4</cols>
					<template>material</template>
					<appearance>outline</appearance>
				</layout>
			</dataRef>
		</dataGroup>
		<event type="finish">
			<id>finish</id>
			<title name="publish">Publish</title>

			<actions phase="pre">
				<action>
					impersonated: f.impersonated;

					validateUser(impersonated.value.id)
				</action>
			</actions>
			<actions phase="post">
				<action>
					impersonated: f.impersonated;

					impersonationService.removeImpersonatorByImpersonated(impersonated.value.id)
				</action>
				<action>
					is_active: f.is_active;

					change is_active value { true }
				</action>
			</actions>
		</event>
	</transition>
	<transition>
		<id>t3</id>
		<x>660</x>
		<y>300</y>
		<label name="deactivate">Deactivate</label>
		<assignPolicy>auto</assignPolicy>

		<roleRef>
			<id>admin_imp</id>
			<logic>
				<view>true</view>
				<cancel>true</cancel>
				<assign>true</assign>
				<delegate>true</delegate>
				<perform>true</perform>
			</logic>
		</roleRef>
		<userRef>
			<id>config_owner</id>
			<logic>
				<view>true</view>
				<cancel>true</cancel>
				<assign>true</assign>
				<delegate>true</delegate>
				<perform>true</perform>
			</logic>
		</userRef>

		<event type="assign">
			<id>assign</id>
			<actions phase="pre">
				<action>
					impersonated: f.impersonated;

					validateUser(impersonated.value.id)
				</action>
			</actions>
		</event>
		<event type="finish">
			<id>finish</id>
			<actions phase="pre">
				<action>
					impersonated: f.impersonated;

					validateUser(impersonated.value.id)
				</action>
			</actions>
			<actions phase="post">
				<action>
					is_active: f.is_active;

					change is_active value { false }
				</action>
			</actions>
		</event>
	</transition>
	<transition>
		<id>t4</id>
		<x>820</x>
		<y>180</y>
		<label name="reactivate">Reactivate</label>
		<assignPolicy>auto</assignPolicy>

		<roleRef>
			<id>admin_imp</id>
			<logic>
				<view>true</view>
				<cancel>true</cancel>
				<assign>true</assign>
				<delegate>true</delegate>
				<perform>true</perform>
			</logic>
		</roleRef>
		<userRef>
			<id>config_owner</id>
			<logic>
				<view>true</view>
				<cancel>true</cancel>
				<assign>true</assign>
				<delegate>true</delegate>
				<perform>true</perform>
			</logic>
		</userRef>

		<dataGroup>
			<id>t4_0</id>
			<cols>4</cols>
			<layout>grid</layout>
			<dataRef>
				<id>impersonators</id>
				<logic>
					<behavior>visible</behavior>
				</logic>
				<layout>
					<x>0</x>
					<y>0</y>
					<rows>1</rows>
					<cols>4</cols>
					<template>material</template>
					<appearance>outline</appearance>
				</layout>
			</dataRef>
			<dataRef>
				<id>impersonated_authorities</id>
				<logic>
					<behavior>visible</behavior>
				</logic>
				<layout>
					<x>2</x>
					<y>1</y>
					<rows>1</rows>
					<cols>2</cols>
					<template>material</template>
					<appearance>outline</appearance>
				</layout>
			</dataRef>
			<dataRef>
				<id>impersonated_roles</id>
				<logic>
					<behavior>visible</behavior>
				</logic>
				<layout>
					<x>0</x>
					<y>1</y>
					<rows>1</rows>
					<cols>2</cols>
					<template>material</template>
					<appearance>outline</appearance>
				</layout>
			</dataRef>
			<dataRef>
				<id>valid_from</id>
				<logic>
					<behavior>visible</behavior>
				</logic>
				<layout>
					<x>0</x>
					<y>2</y>
					<rows>1</rows>
					<cols>2</cols>
					<template>material</template>
					<appearance>outline</appearance>
				</layout>
			</dataRef>
			<dataRef>
				<id>valid_to</id>
				<logic>
					<behavior>visible</behavior>
				</logic>
				<layout>
					<x>2</x>
					<y>2</y>
					<rows>1</rows>
					<cols>2</cols>
					<template>material</template>
					<appearance>outline</appearance>
				</layout>
			</dataRef>
		</dataGroup>

		<event type="assign">
			<id>assign</id>
			<actions phase="pre">
				<action>
					impersonated: f.impersonated;

					validateUser(impersonated.value.id)
				</action>
			</actions>
		</event>
		<event type="finish">
			<id>finish</id>
			<actions phase="pre">
				<action>
					impersonated: f.impersonated;

					validateUser(impersonated.value.id)
				</action>
			</actions>
			<actions phase="post">
				<action>
					is_active: f.is_active;

					change is_active value { true }
				</action>
			</actions>
		</event>
	</transition>
	<place>
		<id>p2</id>
		<x>660</x>
		<y>180</y>
		<tokens>1</tokens>
		<static>false</static>
	</place>
	<place>
		<id>p3</id>
		<x>820</x>
		<y>300</y>
		<tokens>0</tokens>
		<static>false</static>
	</place>
	<place>
		<id>p4</id>
		<x>660</x>
		<y>100</y>
		<tokens>0</tokens>
		<static>false</static>
	</place>
	<arc>
		<id>a2</id>
		<type>regular</type>
		<sourceId>t2</sourceId>
		<destinationId>p2</destinationId>
		<multiplicity>1</multiplicity>
	</arc>
	<arc>
		<id>a3</id>
		<type>regular</type>
		<sourceId>p2</sourceId>
		<destinationId>t3</destinationId>
		<multiplicity>1</multiplicity>
	</arc>
	<arc>
		<id>a4</id>
		<type>regular</type>
		<sourceId>t3</sourceId>
		<destinationId>p3</destinationId>
		<multiplicity>1</multiplicity>
	</arc>
	<arc>
		<id>a5</id>
		<type>regular</type>
		<sourceId>p3</sourceId>
		<destinationId>t4</destinationId>
		<multiplicity>1</multiplicity>
	</arc>
	<arc>
		<id>a6</id>
		<type>regular</type>
		<sourceId>t4</sourceId>
		<destinationId>p2</destinationId>
		<multiplicity>1</multiplicity>
	</arc>
	<arc>
		<id>a14</id>
		<type>regular</type>
		<sourceId>p2</sourceId>
		<destinationId>t2</destinationId>
		<multiplicity>1</multiplicity>
	</arc>
	<arc>
		<id>a15</id>
		<type>regular</type>
		<sourceId>t2</sourceId>
		<destinationId>p4</destinationId>
		<multiplicity>1</multiplicity>
	</arc>
	<arc>
		<id>a16</id>
		<type>read</type>
		<sourceId>p4</sourceId>
		<destinationId>t3</destinationId>
		<multiplicity>1</multiplicity>
	</arc>
</document>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy