Files
Masterarbeit/QuellCode/CentronERP/docs/guides/development/add-a-new-right.md
T
Christoph Schwörer f045b99a25 Codebasis als Dateien ins Arbeitsrepo statt als Gitlink
QuellCode/CentronERP war nur als Gitlink (Submodul-Referenz auf 79c1142)
getrackt, ohne .gitmodules und ohne erreichbares Remote. Der
Untersuchungsgegenstand der Versuchsreihe war damit nicht reproduzierbar
gesichert: Ein Klon haette ein leeres Verzeichnis erhalten, und die Belege
der 3.287 Anforderungen waeren nicht ueberpruefbar gewesen.

Umstellung:
- Historie nach c:\DEV\CentronERP_git_snapshot_79c1142 ausgelagert
  (vollstaendig lesbar, enthaelt 79c1142 und Vorgaenger 89ccfd6)
- Gitlink aus dem Index entfernt
- Dateiinhalt aufgenommen: 24.557 Dateien, rund 333 MB

Die verschachtelte .gitignore der Codebasis gilt weiter, Build-Artefakte
bleiben ausgeschlossen. Details in Versuche/Versuch_01/_Codebasis-Nachweis.md
2026-08-26 07:43:51 +02:00

2.3 KiB

How to add a new right

Creating a new right is quite simple:

First you should open UserRightsConst.cs, since it'll give you the infos you need. You can also open the rightsmodule in c-entron.NET, select a right, then click "I3D kopieren" in the ribbon to find the I3D of a specific right.

You are creating a script that adds a new entry to the Sichrech table:

  • the I3D will later become the value of the right. The next I3D is on top of UserRightsConst.cs

  • Nummer is not important for centron, it can be 0.

  • FomName is important for Delphi, but not for Centron, so it can remain null.

  • the same for FomCont.

  • With Text the name of the right is entered as it is displayed in the rights management.

  • In OwnerRecht the I3D of the right comes in, which is required for your new right.

  • If, on the other hand, another right (or rights) requires your new right(s), NumChildren will show the number of them.

  • at Beschreibung, as the name suggests, a short description comes in, which makes the right.

###ScriptHelpers.AddRightIfNotExists(..) It is highly advised to use ScriptHelpers.AddRightIfNotExists(..) and not write your own script.

The call should look something like this.
If you need more examples check ScriptMethod11250.cs.

yield return ScriptHelpers.AddRightIfNotExists(
UserRightsConst.Sales.Customer.Helpdesk.SHOW_HOURLYSURCHARGERATES,
UserRightsConst.Sales.Customer.Helpdesk.ID,
"Aufschläge Stundensätze anzeigen",
"Dieses Recht gibt an, ob ein Nutzer Aufschläge Stundensätze anzeigen kann.");

###Raw sql script If you have to, your script could look like this:


  <Script Name="AddNewMitarbeiterauslastungRight" ScriptNumber="10870">
    <UpdateQuery>
      <![CDATA[
IF NOT EXISTS (SELECT * FROM Sichrech WHERE I3D = 20800042) BEGIN
	INSERT INTO Sichrech
		(I3D,Nummer, Text, OwnerRecht, NumChildren, Beschreibung)
	VALUES
		(20800042, 0, 'Mitarbeiterauslastung - nur eigene Filiale', 10930, 0, 'Die Gruppen denen dieses Recht zugewiesen wurde, können nur die eigene Filiale in der Mitarbeiterauslastung sehen.');

	UPDATE Sichrech
	SET NumChildren = NumChildren + 1
	WHERE I3D = 10930;
END;
  ]]>
    </UpdateQuery>
  </Script>

At the end you write a constant for your right in UserRightsConst et voilà you can use your right.