Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Alle Rechte, die Sie in Ihrem Projekt definieren, werden im Project Management > Business Objects in der Klasse AuthorizationResources.java verwaltet. Diese Klasse wird automatisch generiert, sobald Sie das erste Mal eine UI-Komponente mit einem Benutzerrecht verknüpfen, z.B. einen XdevButton Save mit dem Recht CustomerSaveAll rights that you define in your project are managed in Project Management > Business Objects in the AuthorizationResources.java class. This class is automatically generated when you link a UI component to a user right, for the first time, e.g. an XdevButton Save with the CustomerSave right.


Code Block
languagejava
themeConfluence
package com.company.example.business;

import com.xdev.security.authorization.Resource;
import com.xdev.security.authorization.ResourceEnum;
import com.xdev.security.authorization.ui.Authorization;

/**
 * Central collection of all authorization resources used in the project.
 */
public enum AuthorizationResources implements ResourceEnum<AuthorizationResources> {
	CUSTOMERSAVE("CustomerSave")
	;

	/**
	 * Helper method to export all resource names.
	 * <p>
	 * Right click and select 'Run As' - 'Java Application'
	 * </p>
	 */
	public static void main(String[] args) {
		for (AuthorizationResources value : AuthorizationResources.values()) {
			System.out.println(value.name);
		}
	}

	/////////////////////////////
	// implementation details //
	///////////////////////////

	private final String name;
	private Resource resource;

	private AuthorizationResources(final String name) {
		this.name = name;
	}

	@Override
	public String resourceName() {
		return this.name;
	}

	@Override
	public Resource resource() {
		if (this.resource == null) {
			this.resource = Authorization.resource(this.name);
		}

		return this.resource;
	}
}

Rechte hinzufügen

...

Add rights

You can add further rights when connecting a UI component to a right by using the wizard or by simply adding other rights to this class.

Code Block
languagejava
themeConfluence
package com.company.example.business;

import com.xdev.security.authorization.Resource;
import com.xdev.security.authorization.ResourceEnum;
import com.xdev.security.authorization.ui.Authorization;

/**
 * Central collection of all authorization resources used in the project.
 */
public enum AuthorizationResources implements ResourceEnum<AuthorizationResources> {
	CUSTOMERSAVE("CustomerSave"),
	CUSTOMERNEW("CustomerNew"),
    CUSTOMERUPDATE("CustomerUpdate"),
    CUSTOMERDELET("CustomerDelete"),
	PRODUCTSAVE("ProductSave"),
	PRODUCTNEW("ProductNew"),
    PRODUCTUPDATE("ProductUpdate"),
    PRODUCTDELETE("ProductDelete")
	;

Ausgabe aller Rechte

Die Klasse AuthorizationResources enthält eine Main Methode die Sie starten können. Damit werden standardmäßig alle Rechte auf der Konsole ausgegeben, sodass Sie diese weiter verarbeiten können, z.B. in Ihrer Datenbank speichern. 

  1. Klicken Sie mit Rechtsklick in den Code der Klasse AuthorizationResources.
  2. Wählen Sie im folgenenden Kontextmenü > Run As > Java Application.
    Image Removed
Hinweis:

...

Show all rights

The class AuthorizationResources contains a Main method that can start. By default, all rights are printed to the console so that you can use them further, e.g. save them in your database. 

  1. Right-click the code of the class AuthorizationResources.
  2. Select Run As > Java Application in the following context menu.
    Image Added
Note:
  • Generate Insert Statements - You can generate either insert statements for your database and other formats of your choice.