A newer version of this page is available. Switch to the current version.

AuthenticationOptions Class

Represents a set of credentials used to identify editable ranges in a protected document.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.RichEdit.v18.2.Core.dll


public class AuthenticationOptions :

The following members accept/return AuthenticationOptions objects:


This code snippet demonstrates how you can fetch usernames assigned to protected ranges in a document and identify the current user as being one of the particular users. It allows you to edit the range with editing permissions granted to that user.

The SubDocument.BeginUpdateRangePermissions method is used to get all permissions for document ranges. Call the SubDocument.CancelUpdateRangePermissions if you do not intend to modify them.

Then, we traverse the collection of range permissions and obtain user names via the RangePermission.UserName property. The ComboBoxEdit control is filled with the names, so an existing name can be selected to log in.

To log in (i.e. to specify the user whose permissions will be in effect), the RichEditControlOptionsBase.Authentication options are used.

Imports DevExpress.XtraRichEdit
Imports DevExpress.XtraRichEdit.API.Native
Imports DevExpress.XtraRichEdit.Services
        Private Sub richEditControl1_DocumentLoaded(ByVal sender As Object, ByVal e As EventArgs)
            richEditControl1.Options.Authentication.UserName = String.Empty
        End Sub
        Private Sub UpdateUserNameLoginCombo()
            RemoveHandler cmbUserName.SelectedValueChanged, AddressOf cmbUserName_SelectedValueChanged
            Dim rangePermissions As RangePermissionCollection = richEditControl1.Document.BeginUpdateRangePermissions()
            Dim users As New List(Of String)()
            For Each rangePermission As RangePermission In rangePermissions
                Dim userName As String = rangePermission.UserName
                If users.Contains(userName) Then
                    Continue For
                End If
                If Not String.IsNullOrEmpty(userName) Then
                End If
            Next rangePermission
            For Each user As MyUser In myUserList
                If Not users.Contains(user.UserName) Then
                End If
            Next user
            cmbUserName.SelectedIndex = 0
            AddHandler cmbUserName.SelectedValueChanged, AddressOf cmbUserName_SelectedValueChanged
        End Sub

        Private Sub cmbUserName_SelectedValueChanged(ByVal sender As Object, ByVal e As EventArgs) Handles cmbUserName.SelectedValueChanged
            Dim username As String = cmbUserName.SelectedItem.ToString()
            richEditControl1.Options.Authentication.UserName = username
            Dim myuser As MyUser = myUserList.Find(Function(s) s.UserName = username)
            richEditControl1.Options.Authentication.Group = If(myuser IsNot Nothing, myuser.Group, String.Empty)

        End Sub
See Also