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

Question

Question

Any recommendations on how to create read-only WebLink users in bulk without SDK?

asked on November 4, 2018 Show version history

Hi guys,

We've got a one-off requirement to create a few hundred read-only Laserfiche user accounts - they're not in AD, so not needing to import accounts, just create them as Laserfiche users - for the implementation of WebLink and there's no budget for SDK.  Is there a way to create them in bulk without SDK?

Thanks,

Mike

0 0

Answer

SELECTED ANSWER
replied on November 6, 2018 Show version history

You can do it with a Workflow SDK Script

You can use CSV or Excel as your source, but for my example, I pushed it into a SQL table.

Then I created a simple Workflow

My Custom Query is:

SELECT [id]
      ,[UserName]
      ,[UserPassword]
      ,[LFGroup]
      ,[IsReadOnly]
  FROM [LFExternalTables].[dbo].[LFUsers];

And my SDK Script looks like this:

        Protected Overrides Sub Execute()
            'Write your code here. The BoundEntryInfo property will access the entry, RASession will get the Repository Access session
            Try
                Dim ui As UserInfo = New UserInfo()
                ui.Session = RASession
                ui.IsDisabled = False
                ui.CanUsePassword = True
                ui.CanChangePassword = False
                ui.Name = GetTokenValue("ForEachRow_UserName")
                ui.Password = GetTokenValue("ForEachRow_UserPassword")
                Dim sGroupName As String = GetTokenValue("ForEachRow_LFGroup")
                If Not String.IsNullOrEmpty(sGroupName) Then
                    ui.JoinGroup(sGroupName)
                End If
                Dim sIsReadOnly As String = GetTokenValue("ForEachRow_IsReadOnly")
                If sIsReadOnly.ToLower() = "true" Then
                    ui.ReadonlyAccess = True
                Else
                    ui.ReadonlyAccess = False
                End If
                ui.Save()
            Catch ex As Exception
                WorkflowApi .TrackError(ex.Message)
            End Try
        End Sub

You may want to add code to the SDK Script to check if the user name already exists, but this is the basics.

2 0
replied on November 6, 2018

Excellent, thanks Bert, with an end of month deadline I was thinking I was going to be spending my weekends creating user accounts manually!  I'll give that a shot.  Thanks again!

0 0
replied on November 19, 2018

Hi Bert,

We've finally got all the user accounts sorted and in SQL and I've started to put the Workflow together, but am getting the error on the SDK: Type 'UserInfo' is not defined.

I'm very much a copy-and-paste developer and thought the Dim statement would have sorted that so don't know what the issue is.  Can you please advise on this?

Thanks very much,

Mike

replied on November 19, 2018

Sorry for the delayed response Bert, it took a while to get all the user accounts sorted and in SQL, but I've just run a test on a handful of users and the process works really well.  

Thanks very much,

Mike

0 0

Replies

replied on November 5, 2018

Regular repository users or Directory Server users? You can batch create LFDS users through a CSV file.

0 0
replied on November 6, 2018

Hi Miruna,

Thanks very much for your response, and sorry, I should have given proper details on the environment.  They’re on Avante so regular repository users I’m afraid.

Thank you,

Mike

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

Sign in to reply to this post.