NAME
Kernel::System::ACL::DB::ACL
DESCRIPTION
ACL DB ACL backend
METHODS
new()
create a ACL object. Do not use it directly, instead use:
my $ACLDBObject = $Kernel::OM->Get('Kernel::System::ACL::DB::ACL');
ACLAdd()
add new ACL
returns the id of the created ACL if success or undef otherwise
my $ID = $ACLDBObject->ACLAdd(
Name => 'NameOfACL' # mandatory
Comment => 'Comment', # optional
Description => 'Description', # optional
StopAfterMatch => 1, # optional
ConfigMatch => $ConfigMatchHashRef, # optional
ConfigChange => $ConfigChangeHashRef, # optional
ValidID => 1, # mandatory
UserID => 123, # mandatory
);
Returns:
$ID = 567;
ACLDelete()
delete an ACL
returns 1 if success or undef otherwise
my $Success = $ACLDBObject->ACLDelete(
ID => 123,
UserID => 123,
);
ACLGet()
get ACL attributes
my $ACL = $ACLDBObject->ACLGet(
ID => 123, # ID or name is needed
Name => 'ACL1',
UserID => 123, # mandatory
);
Returns:
$ACL = {
ID => 123,
Name => 'some name',
Comment => 'Comment',
Description => 'Description',
StopAfterMatch => 1,
ConfigMatch => $ConfigMatchHashRef,
ConfigChange => $ConfigChangeHashRef,
ValidID => 1,
CreateTime => '2012-07-04 15:08:00',
ChangeTime => '2012-07-04 15:08:00',
CreateBy => 'user_login',
ChangeBy => 'user_login',
};
ACLUpdate()
update ACL attributes
returns 1 if success or undef otherwise
my $Success = $ACLDBObject->ACLUpdate(
ID => 123, # mandatory
Name => 'NameOfACL', # mandatory
Comment => 'Comment', # optional
Description => 'Description', # optional
StopAfterMatch => 1, # optional
ValidID => 'ValidID', # mandatory
ConfigMatch => $ConfigMatchHashRef, # optional
ConfigChange => $ConfigChangeHashRef, # optional
UserID => 123, # mandatory
);
ACLList()
get an ACL list
my $List = $ACLDBObject->ACLList(
ValidIDs => ['1','2'], # optional, to filter ACLs that match listed valid IDs
UserID => 1,
);
Returns:
$List = {
1 => 'NameOfACL',
}
ACLListGet()
get an ACL list with all ACL details
my $List = $ACLDBObject->ACLListGet(
UserID => 1,
ValidIDs => ['1','2'], # optional, to filter ACLs that match listed valid IDs
);
Returns:
$List = [
{
ID => 123,
Name => 'some name',
Comment => 'Comment',
Description => 'Description',
ValidID => 1,
ConfigMatch => $ConfigMatchHashRef,
ConfigChange => $ConfigChangeHashRef,
CreateTime => '2012-07-04 15:08:00',
ChangeTime => '2012-07-04 15:08:00',
},
{
ID => 123,
Name => 'some name',
Comment => 'Comment',
Description => 'Description',
ValidID => 1,
ConfigMatch => $ConfigMatchHashRef,
ConfigChange => $ConfigChangeHashRef,
CreateTime => '2012-07-04 15:08:00',
ChangeTime => '2012-07-04 15:08:00',
},
];
ACLsNeedSync()
Check if there are ACLs that are not yet deployed
my $SyncCount = $ACLDBObject->ACLsNeedSync();
Returns:
$SyncCount = 0 || Number of ALCs that need to be synced
ACLsNeedSyncReset()
Reset synchronization information for ACLs.
ACLDump()
gets a complete ACL information dump from the DB
my $ACLDump = $ACLDBObject->ACLDump(
NoOutput => 0, # 0 or 1, default 0, 1 means to just return the created hash structure.
);
Returns: $ACLDump = ' $Self->{TicketACL}->{'SomeName'} = { Possible => {}, PossibleAdd => {}, PossibleNot => {}, Properties => {}, PropertiesDatabase => {}, StopAfterMatch = > 0, }, # … ';
ACLImport()
import an ACL YAML file/content
my $ACLImport = $ACLDBObject->ACLImport(
Content => $YAMLContent, # mandatory, YAML format
OverwriteExistingEntities => 0, # 0 || 1
UserID => 1, # mandatory
);
Returns:
$ACLImport = {
Success => 1, # 1 if success or undef if operation could not
# be performed
Message => 'The Message to show.', # error message
AddedACLs => 'ACL1, ACL2', # list of ACLs correctly added
UpdatedACLs => 'ACL3, ACL4', # list of ACLs correctly updated
ACLErrors => 'ACL5', # list of ACLs that could not be added or updated
};
ACLDeploy()
Deploys ACLs from DB to a perl file and stores deployment information back into the DB.
my $DeploymentID = $ACLDBObject->ACLDeploy(
UserID => 123,
);
Returns:
$DeploymentID = 123; # or false in case of an error
ACLDeploymentRead()
Reads deployment information from the written File.
my %Deployment = $ACLDBObject->ACLDeploymentRead();
Returns:
%Deployment = (
Success => 1,
DeploymentUUID => '14906327941360ed8455f125d0450277',
EffectiveValueStrg => $ACLEffectiveValues, # string with the value of all settings,
# as seen in the Perl configuration file.
Inode => 8041482,
ModifiedTime => 1685422853,
StatusTime => 1685422853,
);
ACLDeploymentGet()
Gets deployment information.
my %Deployment = $ACLDBObject->ACLDeploymentGet(
DeploymentID => 123,
DeploymentUUID => '14906327941360ed8455f125d0450277',
);
Returns:
%Deployment = (
DeploymentID => 123,
DeploymentUUID => '14906327941360ed8455f125d0450277',
EffectiveValueStrg => $ACLEffectiveValues, # string with the value of all settings,
# as seen in the Perl configuration file.
CreateTime => '2016-05-29 11:04:04',
CreateBy => 123,
);
ACLDeploymentListGet()
Get ACL deployment list with complete data.
my @List = $ACLDBObject->ACLDeploymentListGet();
Returns:
@List = (
{
DeploymentID => 123,
DeploymentUUID => 14906327941360ed8455f125d0450277,
EffectiveValueStrg => $ACLEffectiveValues, # String with the value of all ACLs,
# as seen in the Perl cache file.
CreateTime => "2016-05-29 11:04:04",
CreateBy => 123,
},
{
DeploymentID => 456,
DeploymentUUID => 14906327941360ed8455f125d0450288,
EffectiveValueStrg => $ACLEffectiveValues2, # String with the value of all ACLs,
# as seen in the Perl cache file.
CreateTime => "2016-05-29 12:00:01",
CreateBy => 123,
},
# ...
);
ACLDeploymentGetLast()
Get last last ACL deployment.
my %Deployment = $ACLDBObject->ACLDeploymentGetLast();
Returns:
%Deployment = (
DeploymentID => 123,
DeploymentUUID => 14906327941360ed8455f125d0450277,
Comments => 'Some Comments',
EffectiveValueStrg => $SettingEffectiveValues,
CreateTime => "2016-05-29 11:04:04",
CreateBy => 123,
);
ACLDeploymentSync() Updates ZZZACL.pm
to the latest deployment found in the database.
my $Success = $ACLDBObject->ACLDeploymentSync();
ACLDeploymentDelete()
Delete a deployment from the database.
my $Success = $ACLDBObject->ACLDeploymentDelete(
DeploymentID => 123,
);
Returns:
$Success = 1; # or false in case of an error
ACLDeploymentCleanup()
Cleanup old deployments from the database.
my $Success = $ACLDBObject->ACLDeploymentCleanup();
Returns:
$Success = 1; # or false in case of an error
NameIsValid()
Determines if a given string parameter Name is acceptable for ACL Name. Returns 1 if it is. Returns 0 otherwise.
my $IsValid = $ACLDBObject->NameIsValid(
Name => 'Some ACL Name',
);