You are viewing limited content. For full access, please sign in.

Question

Question

SDK/Toolkit question. LogIn method on a Session be used with a user that has "Only allow read-only" access?

SDK
asked on April 14, 2014

Can the LogIn method on a Session be used with a user that has "Only allow read-only" access?

I seem to get a AccessDeniedException.

 

I'm using 8.3 libraries against a 9.1 Laserfiche server instance.

0 0

Replies

replied on April 15, 2014 Show version history

The option to "Only allow read-only" does not affect their ability to log in.  Below is sample code showing log in/out functions.


    ' Global RA Session object set to nothing
    ' This object gets filled when logged in and
    ' reset to nothing when logged out.
    Private _MySession As Session = Nothing
    Public Property MySession As Session
        Get
            Return _MySession
        End Get
        Set(ByVal value As Session)
            _MySession = value
        End Set
    End Property

    Private Sub LFLogin(ByVal sLFServer As String, ByVal sRepo As String, _
            ByVal bWindowAuth As Boolean, Optional ByVal sUser As String = _
            "admin", Optional ByVal sPW As String = "")
        ' Only process if RA Session object is nothing
        If MySession Is Nothing Then
            Try
                ' log into the repository
                Dim repository As New RepositoryRegistration(sLFServer, sRepo)
                MySession = New Session()

                ' Process Authentication
                If bWindowAuth Then
                    ' Connect to the repository
                    MySession.LogIn(repository)
                Else
                    'Do not use empty user name for LF Auth (if that is what was passed)
                    If String.IsNullOrEmpty(sUser) Then
                        ' Try using admin with blank password
                        sUser = "admin"
                        sPW = ""
                    End If
                    ' Connect to the repository
                    MySession.LogIn(sUser, sPW, repository)
                End If
            Catch ex As Exception
                ' Log Errors Here
                MessageBox.Show(ex.Message)
                ' Ensure RA Session object is nothing
                MySession = Nothing
            End Try
        End If
    End Sub

    Private Sub LFLogout()
        ' Only process if RA Session object is not nothing
        If MySession IsNot Nothing Then
            Try
                ' Log Out
                MySession.LogOut()
                ' Set RA Session object to nothing
                MySession = Nothing
            Catch ex As Exception
                ' Log Errors Here
                MessageBox.Show(ex.Message)
                ' Ensure RA Session object is nothing
                MySession = Nothing
            End Try
        End If
    End Sub

 

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.