Difference between revisions of "Authorization DSL"

From OS.bee documentation
Jump to: navigation, search
(Created page with "==Introduction== AuthorizationDSL is used to authorize the roles at runtime. For example, when the sales and logistics check the same entity of article, the sales do not need...")
 
m (corrected indentation)
 
(17 intermediate revisions by 2 users not shown)
Line 7: Line 7:
 
The AuthorizationDSL is working at runtime. It's used to define the roles and authorize them. Visibility processor at runtime calculates the authorization of e.g. invisible or editable for the roles; Blips are working for the bpm process at runtime, e.g. starting the user task.
 
The AuthorizationDSL is working at runtime. It's used to define the roles and authorize them. Visibility processor at runtime calculates the authorization of e.g. invisible or editable for the roles; Blips are working for the bpm process at runtime, e.g. starting the user task.
  
There will be no exported file generated after editing the model. The authorization rules will be store in a hash map at runtime. Each user should have its own position, and the role will be assigned to the positions in OrganizationDSL, which is also working at runtime.  
+
There will be no exported file generated after editing the model. The authorization rules will be store in a hash map at runtime. Each user should have its own position, and the role will be assigned to the positions in [[Organization DSL]], which is also working at runtime.  
  
 
The authorization at runtime will be done according to the rules which we defined in AuthorizationDSL.
 
The authorization at runtime will be done according to the rules which we defined in AuthorizationDSL.
Line 17: Line 17:
 
* “role” - define the role in the fact, e.g. sales, logistics…It contains further elements such as entity and process.
 
* “role” - define the role in the fact, e.g. sales, logistics…It contains further elements such as entity and process.
  
* "entity” - define which entity should be authorized, and how to authorize it for the roles, the entity is defined in EntityDSL model.  
+
* "ENTITY” - define which entity should be authorized, and how to authorize it for the roles, the entity is defined in [[Entity DSL]] model.  
  
* “attribute” - define the authorization of the entity attributes for the roles.
+
* "BEAN” - define which bean should be authorized, and how to authorize it for the roles, the bean is defined in [[Entity DSL]] model.  
* “relation” - define the authorization of the referenced entity for the roles.
+
  
* “process - define which process is startable and if the user task of this process is executable for the roles. The process is defined in BlipDSL model.
+
* "DTO” - define which DTO should be authorized, and how to authorize it for the roles, the DTO is defined in [[DTO DSL]] model.  
  
* “usertask” - define which user task is executable for the roles.
+
* “attribute” -  define the authorization of the entity/bean/DTO attributes for the roles.
 +
 
 +
* “relation” - define the authorization of the referenced entity/bean/DTO for the roles.
 +
 
 +
* “PROCESS” - define which process is STARTABLE and if the user task of this process is TASKABLE for the roles. The process is defined in Bilp DSL model.
 +
 
 +
* “TASK” - define which user task is TASKABLE for the roles.
  
 
===Syntax===
 
===Syntax===
Line 58: Line 63:
 
<syntaxhighlight lang="java">
 
<syntaxhighlight lang="java">
 
role <role name> {
 
role <role name> {
  entity <entity name> ... [{ ... }]
+
    ENTITY <entity name> ... [{ ... }]
 
  ...
 
  ...
   process <blip name>{ ... }
+
   | BEAN <bean name> ... [{ ... }]
 +
  ...
 +
  | DTO <dto name> ... [{ ... }]
 +
  ...
 +
  | PROCESS <blip name>{ ... }
 
   ...
 
   ...
    }
+
}
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 68: Line 77:
 
<syntaxhighlight lang="java">
 
<syntaxhighlight lang="java">
 
role Sales {
 
role Sales {
entity Mproduct_class any
+
  ENTITY Mproduct_class ANY
entity Memployee any {. . .}
+
  ENTITY  Memployee ANY {. . .}
process ProductMaintenance {. . .}
+
  PROCESS ProductMaintenance {. . .}
 
. . .
 
. . .
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
  
In this example, the authorization rule for <code>role</code> '''''Sales''''' will be defined. The rules are using to <code>entity</code> '''''Mproduct_class''''', <code>entity</code> '''''Memployee''''' and <code>process</code> '''''ProductMaintenance'''''.
+
In this example, the authorization rule for <code>role</code> '''''Sales''''' will be defined. The rules are using to <code>ENTITY</code> '''''Mproduct_class''''', <code>ENTITY</code> '''''Memployee''''' and <code>PROCESS</code> '''''ProductMaintenance'''''.
 
+
=====entity=====
+
  
 +
=====ENTITY=====
 
You can define the authorization rule for the whole entity or for one or more attribute/reference of this entity.
 
You can define the authorization rule for the whole entity or for one or more attribute/reference of this entity.
  
 
► '''Syntax''':
 
► '''Syntax''':
 
<syntaxhighlight lang="java">
 
<syntaxhighlight lang="java">
entity <entity name> RoleEnum [{   
+
ENTITY <entity name> RoleEnum [{   
attribute <entityAttribute name> invisible|disabled|noneditable
+
attribute <entityAttribute name> INVISIBLE|DISABLED|NONEDITABLE
relation <entityReference name> invisible|disabled|noneditable
+
relation <entityReference name> INVISIBLE|DISABLED|NONEDITABLE
...
+
...
 
}]
 
}]
 
</syntaxhighlight>
 
</syntaxhighlight>
  
* RoleEnum is including any, creatable, readable, updatable and deletable. It is defined for the whole entity. any means allowed all. Otherwise, only the operation which is listed is allowed, they are creatable, readable, updatable and deletable; it can be one or more operations listed at the same time.
+
* <code>RoleEnum</code> is including ANY, CREATABLE, READABLE, UPDATABLE and DELETABLE. It is defined for the whole entity. any means allowed all. Otherwise, only the operation which is listed is allowed, they are CREATABLE, READABLE, UPDATABLE and DELETABLE; it can be one or more operations listed at the same time.
  
* Entity attribute and reference could be authorized as invisible, disabled and noneditable. Only the operation which is listed is allowed, it can be one or more operations listed at the same time.
+
* Entity attribute and reference could be authorized as INVISIBLE, DISABLED and NONEDITABLE. Only the operation which is listed is allowed, it can be one or more operations listed at the same time.
  
 
► '''Example''':
 
► '''Example''':
 
<syntaxhighlight lang="java">
 
<syntaxhighlight lang="java">
entity Mproduct_class any
+
ENTITY Mproduct_class ANY
+
</syntaxhighlight>
entity Memployee any {
+
 
attribute first_name invisible
+
<syntaxhighlight lang="java">
relation position noneditable
+
ENTITY Memployee ANY{
 +
attribute first_name INVISIBLE
 +
relation position NONEDITABLE
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
The following picture is a dialog of <code>entity</code> '''''Memployee''''', you could see for the <code>role</code> '''''sales''''', the attribute '''''first_name''''' is not shown, only '''''full_name''''' and '''''last_name''''' is shown; the reference '''''position''''' is not editable.<br><br>[[File:AuthorizationDSL_01.png|600px]]<br><br>
 
  
=====process=====
+
The following picture is a dialog of <code>ENTITY</code> '''''Memployee''''', you could see for the <code>role</code> '''''sales''''', the attribute '''''first_name''''' is not shown, only '''''full_name''''' and '''''last_name''''' is shown; the reference '''''position''''' is not editable.<br><br>[[File:AuthorizationDSL_01.png|600px]]<br><br>
 +
 
 +
=====BEAN=====
 +
You can define the authorization rule for the bean or for one or more attribute/reference of this bean.
 +
 
 +
► '''Syntax''':
 +
<syntaxhighlight lang="java">
 +
BEAN <bean name> RoleEnum [{ 
 +
attribute <beanAttribute name> INVISIBLE|DISABLED|NONEDITABLE
 +
relation <beanReference name> INVISIBLE|DISABLED|NONEDITABLE
 +
...
 +
}]
 +
</syntaxhighlight>
 +
 
 +
* <code>RoleEnum</code> is including ANY, CREATABLE, READABLE, UPDATABLE and DELETABLE. It is defined for the bean. any means allowed all. Otherwise, only the operation which is listed is allowed, they are CREATABLE, READABLE, UPDATABLE and DELETABLE; it can be one or more operations listed at the same time.
 +
 
 +
* Bean attribute and reference could be authorized as INVISIBLE, DISABLED and NONEDITABLE. Only the operation which is listed is allowed, it can be one or more operations listed at the same time.
 +
 
 +
► '''Example''':
 +
<syntaxhighlight lang="java">
 +
BEAN Address ANY {
 +
attribute country INVISIBLE
 +
}
 +
</syntaxhighlight>
 +
 
 +
=====DTO=====
 +
You can define the authorization rule for the DTO or for one or more attribute/reference of this DTO.
 +
 
 +
► '''Syntax''':
 +
<syntaxhighlight lang="java">
 +
DTO <dto name> RoleEnum [{ 
 +
attribute <dtoAttribute name> INVISIBLE|DISABLED|NONEDITABLE
 +
relation <dtoReference name> INVISIBLE|DISABLED|NONEDITABLE
 +
...
 +
}]
 +
</syntaxhighlight>
 +
 
 +
* <code>RoleEnum</code> is including ANY, CREATABLE, READABLE, UPDATABLE and DELETABLE. It is defined for the DTO. any means allowed all. Otherwise, only the operation which is listed is allowed, they are CREATABLE, READABLE, UPDATABLE and DELETABLE; it can be one or more operations listed at the same time.
 +
 
 +
* DTO attribute and reference could be authorized as INVISIBLE, DISABLED and NONEDITABLE. Only the operation which is listed is allowed, it can be one or more operations listed at the same time.
 +
 
 +
=====PROCESS=====
 
The process and the user task in this process could be authorized in this part.
 
The process and the user task in this process could be authorized in this part.
  
 
► '''Syntax''':
 
► '''Syntax''':
 
<syntaxhighlight lang="java">
 
<syntaxhighlight lang="java">
process <blip name>{  
+
PROCESS <blip name>{  
[is startable]
+
[is STARTABLE]
[all usertasks executable]
+
[all usertasks TASKABLE]
usertask <blipUserTask name | userTask name> executable
+
TASK <blipTask name|Task name> TASKABLE
...
+
...
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
  
* <code>is startable</code> means: this process <u>is allowed to</u> be started.
+
* <code>is STARTABLE</code> means: this process <u>is allowed to</u> be started.
* <code>all usertasks executable</code> means: all user tasks of this process <u>are allowed to</u> be executed.
+
* <code>all usertasks TASKABLE</code> means: all user tasks of this process <u>are allowed to</u> be executed.
* If not all the user tasks are allowed to be executed, you can define here which user task is allowed to be executed using keyword <code>usertask executable</code>.
+
* If not all the user tasks are allowed to be executed, you can define here which user task is allowed to be executed using keyword <code>TASK TASKABLE</code>.
  
 
► '''Example''':
 
► '''Example''':
 
<syntaxhighlight lang="java">
 
<syntaxhighlight lang="java">
process ProductMaintenance {
+
PROCESS ProductMaintenance {
is startable
+
is STARTABLE
all usertasks executable
+
all usertasks TASKABLE
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 10:32, 2 December 2019

Introduction

AuthorizationDSL is used to authorize the roles at runtime. For example, when the sales and logistics check the same entity of article, the sales do not need to know how many cases per pallet for an article, so it should be invisible in vision of the sales; the logistics do not need to know how much costs the article, so in vision of the logistics, the price should not be displayed.

AuthorizationDSL

The AuthorizationDSL is working at runtime. It's used to define the roles and authorize them. Visibility processor at runtime calculates the authorization of e.g. invisible or editable for the roles; Blips are working for the bpm process at runtime, e.g. starting the user task.

There will be no exported file generated after editing the model. The authorization rules will be store in a hash map at runtime. Each user should have its own position, and the role will be assigned to the positions in Organization DSL, which is also working at runtime.

The authorization at runtime will be done according to the rules which we defined in AuthorizationDSL.

The main semantic elements of the AuthorizationDSL are:

  • “package” - the root element that contains all the other elements. A model can contain multiple packages.
  • “role” - define the role in the fact, e.g. sales, logistics…It contains further elements such as entity and process.
  • "ENTITY” - define which entity should be authorized, and how to authorize it for the roles, the entity is defined in Entity DSL model.
  • "BEAN” - define which bean should be authorized, and how to authorize it for the roles, the bean is defined in Entity DSL model.
  • "DTO” - define which DTO should be authorized, and how to authorize it for the roles, the DTO is defined in DTO DSL model.
  • “attribute” - define the authorization of the entity/bean/DTO attributes for the roles.
  • “relation” - define the authorization of the referenced entity/bean/DTO for the roles.
  • “PROCESS” - define which process is STARTABLE and if the user task of this process is TASKABLE for the roles. The process is defined in Bilp DSL model.
  • “TASK” - define which user task is TASKABLE for the roles.

Syntax

package definition

Syntax:

package <package name>  {
    role <role name> {...}
    ...
}

The package definition of AuthorizationDSL is just like most of the DSL models, you just need to define the package name and in eclipse like other java project press ctrl+shift+o, all necessary models or java classes will be imported automatically. After that, you can define the roles and their authorization rules. One or more roles can be defined in the same package.

Example:

package org.eclipse.osbp.foodmart.authorizations {
	import org.eclipse.osbp.foodmart.entities.* 
	import org.eclipse.osbp.foodmart.blips.*
	. . .
	role Sales {. . .}
	. . .
}

role

This is the main part of this model. Either entity or process could be authorized in this part.

Syntax:

role <role name> {
    ENTITY <entity name> ... [{ ... }]
	  ...
  | BEAN <bean name> ... [{ ... }]
	  ...
  | DTO <dto name> ... [{ ... }]
	  ...
  | PROCESS <blip name>{ ... }
  ...
}

Example:

role Sales {
  ENTITY Mproduct_class ANY
  ENTITY  Memployee ANY {. . .}
  PROCESS ProductMaintenance {. . .}
. . .
}

In this example, the authorization rule for role Sales will be defined. The rules are using to ENTITY Mproduct_class, ENTITY Memployee and PROCESS ProductMaintenance.

ENTITY

You can define the authorization rule for the whole entity or for one or more attribute/reference of this entity.

Syntax:

ENTITY <entity name> RoleEnum [{   
	attribute <entityAttribute name> INVISIBLE|DISABLED|NONEDITABLE
	relation <entityReference name> INVISIBLE|DISABLED|NONEDITABLE
	...
}]
  • RoleEnum is including ANY, CREATABLE, READABLE, UPDATABLE and DELETABLE. It is defined for the whole entity. any means allowed all. Otherwise, only the operation which is listed is allowed, they are CREATABLE, READABLE, UPDATABLE and DELETABLE; it can be one or more operations listed at the same time.
  • Entity attribute and reference could be authorized as INVISIBLE, DISABLED and NONEDITABLE. Only the operation which is listed is allowed, it can be one or more operations listed at the same time.

Example:

ENTITY Mproduct_class ANY
	
ENTITY Memployee ANY{
	attribute first_name INVISIBLE
	relation position NONEDITABLE
}

The following picture is a dialog of ENTITY Memployee, you could see for the role sales, the attribute first_name is not shown, only full_name and last_name is shown; the reference position is not editable.

AuthorizationDSL 01.png

BEAN

You can define the authorization rule for the bean or for one or more attribute/reference of this bean.

Syntax:

BEAN <bean name> RoleEnum [{   
	attribute <beanAttribute name> INVISIBLE|DISABLED|NONEDITABLE
	relation <beanReference name> INVISIBLE|DISABLED|NONEDITABLE
	...
}]
  • RoleEnum is including ANY, CREATABLE, READABLE, UPDATABLE and DELETABLE. It is defined for the bean. any means allowed all. Otherwise, only the operation which is listed is allowed, they are CREATABLE, READABLE, UPDATABLE and DELETABLE; it can be one or more operations listed at the same time.
  • Bean attribute and reference could be authorized as INVISIBLE, DISABLED and NONEDITABLE. Only the operation which is listed is allowed, it can be one or more operations listed at the same time.

Example:

BEAN Address ANY {
	attribute country INVISIBLE
}
DTO

You can define the authorization rule for the DTO or for one or more attribute/reference of this DTO.

Syntax:

DTO <dto name> RoleEnum [{   
	attribute <dtoAttribute name> INVISIBLE|DISABLED|NONEDITABLE
	relation <dtoReference name> INVISIBLE|DISABLED|NONEDITABLE
	...
}]
  • RoleEnum is including ANY, CREATABLE, READABLE, UPDATABLE and DELETABLE. It is defined for the DTO. any means allowed all. Otherwise, only the operation which is listed is allowed, they are CREATABLE, READABLE, UPDATABLE and DELETABLE; it can be one or more operations listed at the same time.
  • DTO attribute and reference could be authorized as INVISIBLE, DISABLED and NONEDITABLE. Only the operation which is listed is allowed, it can be one or more operations listed at the same time.
PROCESS

The process and the user task in this process could be authorized in this part.

Syntax:

PROCESS <blip name>{ 
	[is STARTABLE]
	[all usertasks TASKABLE]
	TASK <blipTask name|Task name> TASKABLE
	...
}
  • is STARTABLE means: this process is allowed to be started.
  • all usertasks TASKABLE means: all user tasks of this process are allowed to be executed.
  • If not all the user tasks are allowed to be executed, you can define here which user task is allowed to be executed using keyword TASK … TASKABLE.

Example:

PROCESS ProductMaintenance {
	is STARTABLE
	all usertasks TASKABLE
}

Copyright Notice

All rights are reserved by Compex Systemhaus GmbH. In particular, duplications, translations, microfilming, saving and processing in electronic systems are protected by copyright. Use of this manual is only authorized with the permission of Compex Systemhaus GmbH. Infringements of the law shall be punished in accordance with civil and penal laws. We have taken utmost care in putting together texts and images. Nevertheless, the possibility of errors cannot be completely ruled out. The Figures and information in this manual are only given as approximations unless expressly indicated as binding. Amendments to the manual due to amendments to the standard software remain reserved. Please note that the latest amendments to the manual can be accessed through our helpdesk at any time. The contractually agreed regulations of the licensing and maintenance of the standard software shall apply with regard to liability for any errors in the documentation. Guarantees, particularly guarantees of quality or durability can only be assumed for the manual insofar as its quality or durability are expressly stipulated as guaranteed. If you would like to make a suggestion, the Compex Team would be very pleased to hear from you.

(c) 2016-2024 Compex Systemhaus GmbH