Codeblock Onlinehilfe

TBeCbPermissionController

TBeCbPermissionController

Kapselung von Funktionen für die Verwendung von Benutzer-Rollen (RABAC) im Codeblock.

Eigenschaften

Eigenschaft

Beschreibung

Name:C


Tag:N


Methoden

Methode

Beschreibung

CbUserInGroup(aKey:C, aUserNo:U, aDepartment:N, aLocation:N):L

Prüft ob einem Benutzer eine Gruppen-Rolle zugewiesen ist

CbUserHasRole(aKey:C, aUserNo:U, aDepartment:N, aLocation:N):L

Prüft, ob ein bestimmter Benutzer einer bestimmten Rolle zugeordnet ist.

CbGetUserRoles(aUserNo:U, aDepartment:N, aLocation:N):U

Liefert ein Array mit den Schlüsseln aller aktiven Rollen

CbAldUserInGroup(aKey:C, aAltvernativeUserNo:U, aDepartment:N, aLocation:N):L

Prüft ob einem Alternativen-Login eine Gruppen-Rolle zugewiesen ist

CbAldUserHasRole(aKey:C, aAltvernativeUserNo:U, aDepartment:N, aLocation:N):L

Prüft, ob ein bestimmter Alternativer-Login-Benutzer einer bestimmten Rolle zugeordnet ist.

CbGetAldUserRoles(aAltvernativeUserNo:U, aDepartment:N, aLocation:N):U

Liefert ein Array mit den Schlüsseln aller aktiven Rollen

CbGetFunctionPermission(aObjectName:C, aActionName:C, aUserNo:U, aDepartment:N, aLocation:N):N


CbCanReadTable(aWorkArea:N, aUserNo:U, aDepartment:N, aLocation:N):L

Prüft, ob Datensätze in der Tabelle gelesen werden können

CbCanEditTable(aWorkArea:N, aUserNo:U, aDepartment:N, aLocation:N):L

Prüft, ob Datensätze in der Tabelle geändert werden können

CbCanInsertIntoTable(aWorkArea:N, aUserNo:U, aDepartment:N, aLocation:N):L

Prüft, ob Datensätze in die Tabelle eingefügt werden können

CbCanDeleteFromTable(aWorkArea:N, aUserNo:U, aDepartment:N, aLocation:N):L

Prüft, ob Datensätze aus der Tabelle gelöscht werden können

CbCanReadField(aWorkArea:N, aFieldName:C, aUserNo:U, aDepartment:N, aLocation:N):L

Prüft, ob das Feld in der Tabelle gelesen werden kann

CbCanEditField(aWorkArea:N, aFieldName:C, aUserNo:U, aDepartment:N, aLocation:N):L

Prüft, ob das Feld in der Tabelle geändert werden kann

CbCleanupPermissions()


CbIsDeniedFormAction(aFormClassName:C, aFormActionName:C, aUserNo:N, aDepartment:N, aLocation:N):L

Prüft, ob die Formularaktion eingeblendet wird

CbIsDeniedModule(aModuleName:C, aUserNo:N, aDepartment:N, aLocation:N):L

Prüft, ob der Modul eingeblendet wird

CbIsGrantedFormAction(aFormClassName:C, aFormCaption:C, aFormActionName:C, aFormActionCaption:C, aUserNo:N, aDepartment:N, aLocation:N):L

Prüft, ob die Formularaktion durchgeführt werden könnten (ohne Passwort)

CbIsGrantedFormActionPassword(aFormClassName:C, aFormActionName:C, aPassword:C, aUserNo:N, aDepartment:N, aLocation:N):L

Prüft, ob die Formularaktion durchgeführt werden könnten (mit Passwort)

CbIsGrantedGlobal(aActionName:C, aPassword:C, aConsiderPassword:L, aUserNo:N, aDepartment:N, aLocation:N):L

Prüft, ob die globale Aktion durchgeführt werden könnte

CbIsGrantedGlobalCompany(aCompany:N, aPassword:C, aConsiderPassword:L, aUserNo:N, aDepartment:N, aLocation:N):L

Prüft, ob der Mandant zugegriffen werden könnte

CbIsGrantedGlobalDepartment(aGrantedDepartment:N, aPassword:C, aConsiderPassword:L, aUserNo:N, aDepartment:N, aLocation:N):L

Prüft, ob die Abteilung zugegriffen werden könnte

CbIsGrantedGlobalLocation(aGrantedLocation:N, aPassword:C, aConsiderPassword:L, aUserNo:N, aDepartment:N, aLocation:N):L

Prüft, ob der Standort zugegriffen werden könnte

CbIsGrantedModule(aModuleName:C, aPassword:C, aConsiderPassword:L, aUserNo:N, aDepartment:N, aLocation:N):L

Prüft, ob das Modul zugegriffen werden könnte

CbCreatePermissionsOverviewMemTable():O

Erzeugt eine Memtable zur Verndung mit CbCalcUserPermissions() und CbCalcRolePermissions() **Wichtig:** die Memtable gehört dem Controller und wird zerstört wenn dieser zerstört wird

CbCalcUserPermissions(aUserNo:N, aDepartment:N, aLocation:N, aMemTable:O)

Ermittelt die “Effektiven Berechtigungen” eines Users (analog zur Benutzerverwaltung)

CbCalcRolePermissions(aRoleGUID:C, aMemTable:O)

Ermittelt die “Effektiven Berechtigungen” einer Roller (analog zur Rollenverwaltung)

Beispiel

|
  oPC, nUser
|

nUser := 67, // mbeUser,

oPC := CreateObject('TBeCbPermissionController'),
startseq
  Writeln('Module'),
  WriteLn(' UPDATE: ' + iif(oPC.CbIsDeniedModule('/UPDATE', nUser, MABTEILUNG, MSTANDORT), 'Denied', 'not Denied') +
          ' / FIBU: ' + iif(oPC.CbIsDeniedModule('/FIBU', nUser, MABTEILUNG, MSTANDORT), 'Denied', 'not Denied')),
  Writeln(' UPDATE: ' + iif(oPC.CbIsGrantedModule('/UPDATE', '**', false, nUser, MABTEILUNG, MSTANDORT), 'Allowed', 'Denied') +
          ' + pwd: ' + iif(oPC.CbIsGrantedModule('/UPDATE', '**', true, nUser, MABTEILUNG, MSTANDORT), 'Allowed', 'Denied') +
          ' + falsche pwd: ' + iif(oPC.CbIsGrantedModule('/UPDATE', '***', true, nUser, MABTEILUNG, MSTANDORT), 'Allowed', 'Denied') +
          ' / FIBU: ' + iif(oPC.CbIsGrantedModule('/FIBU', '**', false, nUser, MABTEILUNG, MSTANDORT), 'Allowed', 'Denied') +
          ' + pwd: ' + iif(oPC.CbIsGrantedModule('/FIBU', '**', true, nUser, MABTEILUNG, MSTANDORT), 'Allowed', 'Denied')),

  Writeln('TFormEditArticle.A_New'),
  Writeln(' ' + iif(oPC.CbIsDeniedFormAction('TFormEditArticle', 'A_New', nUser, MABTEILUNG, MSTANDORT), 'Denied', 'Allowed') +
          ' / ' + iif(oPC.CbIsGrantedFormAction('TFormEditArticle', '', 'A_New', '', nUser, MABTEILUNG, MSTANDORT), 'Allowed', 'Denied') +
          ' + pwd: ' + iif(oPC.CbIsGrantedFormActionPassword('TFormEditArticle', 'A_New', '**', nUser, MABTEILUNG, MSTANDORT), 'Allowed', 'Denied')),

  Writeln('AllActions'),
  Writeln(' ' + iif(oPC.CbIsGrantedGlobal('AllActions', '**', false, nUser, MABTEILUNG, MSTANDORT), 'Allowed', 'Denied') +
          ' + pwd: ' + iif(oPC.CbIsGrantedGlobal('AllActions', '**', true, nUser, MABTEILUNG, MSTANDORT), 'Allowed', 'Denied')),

  Writeln('Mandat 000'),
  Writeln(' ' + iif(oPC.CbIsGrantedGlobalCompany(000, '**', false, nUser, MABTEILUNG, MSTANDORT), 'Allowed', 'Denied') +
          ' + pwd: ' + iif(oPC.CbIsGrantedGlobalCompany(000, '**', true, nUser, MABTEILUNG, MSTANDORT), 'Allowed', 'Denied')),

  Writeln('Abteilung ' + Str(mAbteilung)),
  Writeln(' ' + iif(oPC.CbIsGrantedGlobalDepartment(mAbteilung, '**', false, nUser, MABTEILUNG, MSTANDORT), 'Allowed', 'Denied') +
          ' + pwd: ' + iif(oPC.CbIsGrantedGlobalDepartment(mAbteilung, '**', true, nUser, MABTEILUNG, MSTANDORT), 'Allowed', 'Denied')),

  Writeln('Standort ' + Str(mStandort)),
  Writeln(' ' + iif(oPC.CbIsGrantedGlobalLocation(mStandort, '**', false, nUser, MABTEILUNG, MSTANDORT), 'Allowed', 'Denied') +
          ' + pwd: ' + iif(oPC.CbIsGrantedGlobalLocation(mStandort, '**', true, nUser, MABTEILUNG, MSTANDORT), 'Allowed', 'Denied')),
always
   DestroyObject(oPC),
stopseq,
|
  cLogFileName, oPermissionController,
  bReset, bPreprocess, bCleanup,
  bMigrate, bMigrateUsers, bMigrateMasks, bMigratePermissions
|

bReset              := True,
bPreprocess         := True,
bCleanup            := False,
bMigrate            := True,
bMigrateUsers       := True,
bMigrateMasks       := True,
bMigratePermissions := True,

//******************************************************************************
// Log-Funktion
//******************************************************************************
function Log(cMessage)
   ProcessMsg(),
   WriteLn(cMessage),
   RABAC_Log(cLogFileName, cMessage),
   ProcessMsg(),
end,

cLogFileName          := 'C:\be_debug\rabac_migration.log',
oPermissionController := CreateObject('TBeCbPermissionController'),
startseq
   oPermissionController.CbLogFileName := cLogFileName,
   // --------------------------------------------------------------------------
   if bReset then
      Log('Resetting RABAC Data ...'),
      oPermissionController.CbMigration.CbReset(),
   endif,
   // --------------------------------------------------------------------------
   if bPreprocess then
      if oPermissionController.CbMigration.CbPreprocessDabMSK() then
         Log('Preprocess DabMSK: OK'),
      else
         Log('Preprocess DabMSK: FAILED'),
         bMigrate := False,
         if bCleanup then
            oPermissionController.CbMigration.CbCleanupDabMSK(),
         endif,
      endif,
      if oPermissionController.CbMigration.CbPreprocessDabPWD() then
         Log('Preprocess DabPWD: OK'),
      else
         Log('Preprocess DabPWD: FAILED'),
         bMigrate := False,
         if bCleanup then
            oPermissionController.CbMigration.CbCleanupDabPWD(),
         endif,
      endif,
   endif,
   // --------------------------------------------------------------------------
   if bMigrate and
      (bMigrateUsers or bMigrateMasks or bMigratePermissions) then
      Log('Running Migration ...'),
      if bMigrateUsers then
         Log('Migration: Users'),
         oPermissionController.CbMigration.CbMigrateUsers(),
      endif,
      if bMigrateMasks then
         Log('Migration: Masks'),
         oPermissionController.CbMigration.CbMigrateMasks(),
      endif,
      if bMigratePermissions then
         Log('Migration: Permissions'),
         oPermissionController.CbMigration.CbMigratePermissions(),
      endif,
      Log('Migration: DONE'),
      Log('Running CleanupPermissionRoles'),
      oPermissionController.CbMigration.CbCleanupPermissionRoles(),
      Log('CleanupPermissionRoles: DONE'),
 else
      Log('Skipping Migration ...'),
   endif,
always
   DestroyObject(oPermissionController),
stopseq,

Weitere Verknüpfungen