Page 1 of 2 1 2 LastLast
Showing results 1 to 10 of 11

Thread: Logging into multiple projects

  1. #1
    Join Date
    29.02.2008
    Posts
    40

    Frage Logging into multiple projects

    Hey,

    I'm having problem logging user into mutliple projects. In my workspace, I have a main project, witch contains a few sub-projects. I was trying to implement metods from this thread.
    When I used herbertos code, I was getting message box saying "Invalid user identification!". When I make the user in the project, it works. But...I have 10 sub-projects already (more to come) and quite a lot of users, witch makes creating user by user a bit time consuming.
    I also tried modified version of his code, witch should create new users and log them into projects. But...didnt work. Function CreateUser in VBA somehow does not want to create a new user, if it is executed via zenon runtime. CreateUser works if I run it via debug mode in VBA.
    Any help is appreciated!

    Modified code:
    Option Explicit
     
    Dim WithEvents myPwd As Passwords
     
    'event fired on starting runtime
    Private Sub Project_Active()
     
        'create object for "UserChange" event
        Set myPwd = thisProject.Passwords
    End Sub
     
    'event fired when a user logged in
    Private Sub myPwd_UserChange()
     
    Dim iProjCount As Integer
    Dim level, level1, level2, level3
    Dim zUsername, zUserIden As String
     
    zUsername = myPwd.loggedUser
    zUserIden = myPwd.ItemUser(zUsername).Identification
    
    level = myPwd.ItemUser(zUsername).level
    level1 = myPwd.ItemUser(zUsername).level1
    level2 = myPwd.ItemUser(zUsername).level2
    level3 = myPwd.ItemUser(zUsername).level3
      
        On Error GoTo Errorhandler
     
            'go through all projects
            For iProjCount = 0 To thisProject.Parent.Count - 1
                'check if this is the integration project itself (no double login)
                'MsgBox thisProject.Parent.Item(iProjCount).Name
                If StrComp(thisProject.Guid, thisProject.Parent.Item(iProjCount).Guid) <> 0 Then
                    'check if the new user is the system user (logout)
                    If myPwd.loggedUser = "0000" Then
                        thisProject.Parent.Item(iProjCount).Passwords.Logoff
                    Else
    
                        'first create new user
                        thisProject.Parent.Item(iProjCount).Passwords.CreateUserEx zUserIden, zUsername, "", level, level1, level2, level3
                        
                        'log in the user (from the integration project)
                        thisProject.Parent.Item(iProjCount).Passwords.Login (zUsername)
     
                        'check if the login was successful
                        If thisProject.Parent.Item(iProjCount).Passwords.loggedUser <> zUsername Then
                            'user could NOT be logged in
                            'write to CEL of integration project
                            thisProject.Parent.Item(0).Cel.WriteCelString ("User: """ & zUsername & """ could not be logged into project: " & thisProject.Parent.Item(iProjCount).Name)
                        End If
                    End If
                End If
            Next iProjCount
        Exit Sub
     
    Errorhandler:
       'an error has occured
        If err.Number <> 0 Then
            'write to CEL of integration project
            thisProject.Parent.Item(0).Cel.WriteCelString ("There was an error while trying to log into the project: " & thisProject.Parent.Item(iProjCount).Name)
            Resume Next
        End If
    End Sub
     
    'event fired on closing runtime
    Private Sub Project_Inactive()
     
        'release the created object
        Set myPwd = Nothing
    End Sub

  2. #2
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    879

    Default AW: Logging into multiple projects

    if all users should be available for all projects (sub-projects) i would suggest to define those users in a global project. Thus you only have to create a new user once in the global project, compile all changed data for all projects....

    regards,
    herbert

  3. #3
    Join Date
    29.02.2008
    Posts
    40

    Default Re: AW: Logging into multiple projects

    Thanks for anwser. Currently I have a few users made, all defined in global project. I have compiled and reloaded all projects correctly. But still, this code is returning me "Invalid user identification!" for all project it tries to log in.

  4. #4
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    879

    Default AW: Logging into multiple projects

    you may check the project setting "RT changeable" data" - the checkbox for "user administration" needs to be disabled... for all projects..

  5. #5
    Join Date
    29.02.2008
    Posts
    40

    Default Re: AW: Logging into multiple projects

    Disabling didnt help, any other ideas?

  6. #6
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    879

    Default AW: Logging into multiple projects

    you may direct contact copadata support in this case. please send in an email the workspace backup and a short description.

    regards,
    herbert

  7. #7

    Default Re: Logging into multiple projects

    Hi,

    After the suggestion from Herbert, to uncheck the checkbox for passwords in the "rt changeable data" in the column "do not compile and transfer", did you compile the runtime files for all projects, and transferred the runtime files?

    Only unchecking this option in the editor, does not change anything

    You have probably done it, but I'm just checking and trying to help

    Regards,
    Mark

  8. #8
    Join Date
    29.02.2008
    Posts
    40

    Default Re: Logging into multiple projects

    I have disabled option "do not generate and transfer" and "do not compile" by selecting the checkbox for all subprojects. I have reloaded for all projects, of course.
    Tough I am not sure if I need to transfer runtime files; the application is ment to run on one computer only.

  9. #9
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    879

    Default AW: Logging into multiple projects

    We received the inquiry at the support and created a ticket out of it.

    One thing which I want to point out in this thread:
    in your code:
    'first create new user
    thisProject.Parent.Item(iProjCount).Passwords.Crea teUserEx zUserIden, zUsername, "", level, level1, level2, level3


    If you define the users in the global project (so in the editor) there is no need to create the user again in VBA!
    -> so please remove this code line and give a short feedback if the login function via vba is working

    Regards,
    Herbert

  10. #10
    Join Date
    29.02.2008
    Posts
    40

    Default Re: AW: Logging into multiple projects

    No, the code isn't working, as stated in the 1st post in this thread. I am getting message box saying "Invalid user identification!", for each project your original code tries to login.

Similar Threads

  1. how to combine three different projects
    By tanveerali in forum zenon Supervisor
    Replies: 8
    Last Post: 29th July 2019, 08:13
  2. Return to last in 2 projects
    By croc in forum zenon Supervisor
    Replies: 7
    Last Post: 12th March 2012, 00:35
  3. Integrating Projects
    By talal.mubarak in forum zenon Supervisor
    Replies: 2
    Last Post: 6th September 2011, 23:17
  4. How to Stop Logging Alarms
    By matholton in forum zenon Supervisor
    Replies: 2
    Last Post: 29th September 2008, 11:24
  5. start different projects on CE
    By sebastiank in forum zenon Operator
    Replies: 0
    Last Post: 25th September 2007, 08:14

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •