Codeunit "Security Group"
Exposes functionality for working with security groups. Security groups correspond to either Windows groups or Microsoft Entra security groups depending on the authentication type.
Properties
| Name | Value |
|---|---|
| Access | Public |
Methods
Create
Creates a new security group.
procedure Create(GroupCode: Code[20], GroupId: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| GroupCode | Code[20] |
The code of the newly created group. |
| GroupId | Text |
The SID of a Windows group or object ID of the Microsoft Entra security group. |
Delete
Deletes a security group.
procedure Delete(GroupCode: Code[20])
Parameters
| Name | Type | Description |
|---|---|---|
| GroupCode | Code[20] |
The code of the group to delete. |
Copy
Copies a security group.
procedure Copy(SourceGroupCode: Code[20], DestinationGroupCode: Code[20], DestinationGroupId: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| SourceGroupCode | Code[20] |
The code of the security group to copy. |
| DestinationGroupCode | Code[20] |
The code of the copied security group. |
| DestinationGroupId | Text |
The ID of the copied security group. |
CopyPermissions
Copies permission sets from the source security group to the destination security group.
procedure CopyPermissions(SourceGroupCode: Code[20], DestinationGroupCode: Code[20])
Parameters
| Name | Type | Description |
|---|---|---|
| SourceGroupCode | Code[20] |
The code of the security group to fetch the permissions from. |
| DestinationGroupCode | Code[20] |
The code of the security group to add the the permissions to. |
AddPermissionSet
Adds a permission set to a security group.
procedure AddPermissionSet(GroupCode: Code[20], RoleId: Code[20], Company: Text[30], Scope: Option, AppId: Guid)
Parameters
| Name | Type | Description |
|---|---|---|
| GroupCode | Code[20] |
The code of the security group to add a permission set to. |
| RoleId | Code[20] |
The ID of the role (permission set). |
| Company | Text[30] |
The company for which to add the permission set. |
| Scope | Option |
The scope of the permission set. |
| AppId | Guid |
The ID of the app from which the permission set originates. |
RemovePermissionSet
Removes a permission set from a security group.
procedure RemovePermissionSet(GroupCode: Code[20], RoleId: Code[20], Company: Text[30], Scope: Option, AppId: Guid): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| GroupCode | Code[20] |
The code of the security group to remove a permission set from. |
| RoleId | Code[20] |
The ID of the role (permission set). |
| Company | Text[30] |
The company for which to remove the permission set. |
| Scope | Option |
The scope of the permission set. |
| AppId | Guid |
The ID of the app from which the permission set originates. |
Returns
| Type | Description |
|---|---|
| Boolean |
True, if the permission set was removed, false otherwise. |
GetGroups
Gets all the defined security groups.
procedure GetGroups(var SecurityGroupBuffer: Record "Security Group Buffer" temporary)
Parameters
| Name | Type | Description |
|---|---|---|
| SecurityGroupBuffer | Table System.Security.AccessControl."Security Group Buffer" |
The resulting list of security groups. |
GetGroups
Gets all the defined security groups.
procedure GetGroups(var SecurityGroupBuffer: Record "Security Group Buffer" temporary, FetchGroupNames: Boolean)
Parameters
| Name | Type | Description |
|---|---|---|
| SecurityGroupBuffer | Table System.Security.AccessControl."Security Group Buffer" |
The resulting list of security groups. |
| FetchGroupNames | Boolean |
Specifies if group names should be fetched, as loading them can take some time. |
GetMembers
Gets all the security group memberships.
procedure GetMembers(var SecurityGroupMemberBuffer: Record "Security Group Member Buffer" temporary): List of [Code[20]]
Parameters
| Name | Type | Description |
|---|---|---|
| SecurityGroupMemberBuffer | Table System.Security.AccessControl."Security Group Member Buffer" |
The resulting list of users and security groups they are a part of. |
Returns
| Type | Description |
|---|---|
| List of [Code[20]] |
The list of security groups that could not be retrieved successfully from Graph / Windows Active Directory. |
ValidateGroupId
Validates the group ID that can be used for a security group.
procedure ValidateGroupId(GroupId: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| GroupId | Text |
The SID of a Windows group or object ID of the Microsoft Entra security group. |
GetGroupUserSecurityId
Gets the user security ID of a special user record that corresponds to a Microsoft Entra security group or Windows group.
procedure GetGroupUserSecurityId(GroupCode: Code[20]): Guid
Parameters
| Name | Type | Description |
|---|---|---|
| GroupCode | Code[20] |
The code of the security group for which to get the group user security ID. |
Returns
| Type | Description |
|---|---|
| Guid |
The user security ID of a special user record that corresponds to a Microsoft Entra security group or Windows group. |
GetName
Gets the name of the security group.
procedure GetName(GroupCode: Code[20], var GroupName: Text[250]): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| GroupCode | Code[20] |
The code of the security group. |
| GroupName | Text[250] |
The name of the security group. |
Returns
| Type | Description |
|---|---|
| Boolean |
True, if the operation succeeds, false otherwise. |
GetId
Gets the SID of a Windows group or an object ID of a Microsoft Entra security group by group code.
procedure GetId(GroupCode: Code[20]): Text[250]
Parameters
| Name | Type | Description |
|---|---|---|
| GroupCode | Code[20] |
The code of the security group. |
Returns
| Type | Description |
|---|---|
| Text[250] |
The ID of the security group. |
GetCode
Gets the code of the security group by its ID.
procedure GetCode(GroupId: Text[250], var GroupCode: Code[20]): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| GroupId | Text[250] |
The SID of a Windows group or an object ID of a Microsoft Entra security group. |
| GroupCode | Code[20] |
The code of the security group. |
Returns
| Type | Description |
|---|---|
| Boolean |
True, if the code was found successfully, false otherwise. |
IsWindowsAuthentication
Checks whether the current authentication type is Windows, meaning that Windows groups will be used for defining security groups.
procedure IsWindowsAuthentication(): Boolean
Returns
| Type | Description |
|---|---|
| Boolean |
True, if the current authentication type is Windows, false otherwise. |
Export
Exports the provided list of security groups.
procedure Export(SecurityGroupCodes: List of [Code[20]], Destination: OutStream)
Parameters
| Name | Type | Description |
|---|---|---|
| SecurityGroupCodes | List of [Code[20]] |
The codes of security groups to export. |
| Destination | OutStream |
The OutStream that the resulting XML content will be written to. |
Import
Imports a list of security groups.
procedure Import(Source: InStream)
Parameters
| Name | Type | Description |
|---|---|---|
| Source | InStream |
The InStream containing the XML content to import. |