[ProjectWise SDK] alternative to aaApi_LoginDlg?

I must be missing something 

i need to show a login dialog (NON ADMIN) but in teh login functions page of the SDK docs it says aaApi_LoginDlg is deprecated and to use aaApi_LoginDlgExt. 

but aaApi_LoginDlgExt says it preforms admin log in. i dont see a log in DIALOG function to log in not as an admin. i have to be missing it.

Parents
  • Another example of "words get in the way".

    The documentation for aaApi_LoginDlgExt() says:

    This function presents the Administrative ProjectWise login dialog. 

    It does not say "performs an administrative login", i.e. it just uses the dialog box that can perform an administrative login!  Certainly easy to misinterpret!!

    The key to how it is used is controlled by the values passed via the ulFlags parameter, which is not well documented.  If you click on the link to Login Dialog Style Flags there isn't anything listed (in the version that I am using) other than this less than helpful message:

    This structure is used to specify login information. More... 
     
    This structure is used to specify login information
    

    The first topic I cover in the ProjectWise SDK training class is "how to use help".  The point of the exercise is to learn some of the peculiar ways of the help documentation such as understanding that legacy names remain in use for some API terms such as project, vault, folder, and rich project, are all "folders" in ProjectWise, with the first three are used because when those functions were introduced, that was the name in use for what we now call "folders", and the last term, "rich project", was a way around the fact that "project" was already in use when ProjectWise Projects were introduced (now renamed to "Work Areas").

    In any case, the trick in this case is t to search the .h and .fdf files for clues.  If you search for "login" or "aaApi_LoginDlgExt", etc., you will eventually come across this in aawddef.h:

    #define AALOGIN_ADMINISTRATIVE            0x00010000L       /**< Admin login is performed. */
    #define AALOGIN_HIDE_SSO_GROUP            0x00020000L       /**< Hides extra check boxes of login dialog. These include SSO ("Use Windows credentials...")
                                                                     and auto-login ("Auto-login to this datasource") check boxes. Even if auto-login check box
                                                                     is hidden, automatic login will continue to work, but its configuration through login dialog
                                                                     will be unavailable. */
    #define AALOGIN_FILTER_DATASOURCE_LIST    0x00040000L       /**< Datasource selection drop-down list control will only list the datasources,
                                                                     to which there are no connections created yet. Datasources, to which
                                                                     application has connections, will be filtered out.*/
    #define AALOGIN_NO_AUTOLOGIN              0x00080000L       /**< Disables automatic-login. When set, automatic login
                                                                     configuration check box will be hidden too. */
    #define AALOGIN_INFO_ACTIVATE             0x01000000L       /**< Datasource handle already exists and datasource
                                                                     activation should be performed instead of login.
                                                                     \note This flag is for internal login operations and
                                                                     is not valid for aaApi_LoginDlgExt(). */
    #define AALOGIN_ADMIN                     0x02000000L       /**< Administrative login should be performed.
                                                                     \note This flag is for internal login operations and
                                                                     is not valid for aaApi_LoginDlgExt(). */
    #define AALOGIN_PASSWD_DONT_VERIFY        0x04000000L       /**< Don't verify the supplied password (datasource create)
                                                                     \note This flag is for internal login operations and
                                                                     is not valid for aaApi_LoginDlgExt(). */
    #define AALOGIN_NO_WORKING_DIR_VERIFY     0x08000000L       /**< Don't verify that the user's working directory exists.
                                                                     \note This flag is for internal login operations and
                                                                     is not valid for aaApi_LoginDlgExt(). */
    #define AALOGIN_DATASOURCE_AS_SERVER      0x10000000L       /**< Regard Datasource Name as Server Name.
                                                                     \note This flag is only for login server to validate authority. */
    

    Looking carefully, you can see both AALOGIN_ADMINISTRATIVE and AALOGIN_ADMIN, but the comments indicate the AALOGIN_ADMIN is for "internal login operations and is not valid for aaApi_LoginDlgExt()".

    OK, so how does this work?

    This bit of code will let any user log in, but none of the administrative functions are available:

            // login
            if (IDOK==aaApi_LoginDlgExt (NULL, L"Custom Login", 0,
                szDSource, sizeof(szDSource)/sizeof(WCHAR), szUser, szPassword, NULL))
            {
                TRACE (L"Login successful!\n");
                bLoggedIn = TRUE;
                this->m_ptrButLogin.SetWindowTextW (L"LogOut");
                return;
            }
            else
            {
                TRACE (L"Login canceled or aborted!\n");
                bLoggedIn = FALSE;
                this->m_ptrButLogin.SetWindowTextW (L"Login");
                return;
            }
    

    And this bit of code will only let ProjectWise administrators log in, and the session will have access to the administrative functions as well as to the non-administrative functions in the API.

            // login
            if (IDOK==aaApi_LoginDlgExt (NULL, L"Custom Login", AALOGIN_ADMINISTRATIVE,
                szDSource, sizeof(szDSource)/sizeof(WCHAR), szUser, szPassword, NULL))
            {
                TRACE (L"Login successful!\n");
                bLoggedIn = TRUE;
                this->m_ptrButLogin.SetWindowTextW (L"LogOut");
                return;
            }
            else
            {
                TRACE (L"Login canceled or aborted!\n");
                bLoggedIn = FALSE;
                this->m_ptrButLogin.SetWindowTextW (L"Login");
                return;
            }
    

    And yes, I fully agree, the documentation could be better!

    Looking again at the documentation, if you look at the deprecated function aaApi_AdminLoginDlg(), you will see this:

    This function presents the Administrative ProjectWise login dialog. 
    
    This function attempts to silently log-in the specified administrative user to the specified datasource. If the login attempt fails, the login dialog is shown and the user is offered to perform custom login himself. This behavior is equal to aaApi_LoginDlgExt() with the AALOGIN_SILENT and AALOGIN_ADMINISTRATIVE flags on.
    
    Automatic login functionality is unavailable in login dialogs shown by this function. This is because silent login implicitly disables automatic login.
    

    Hope this helps!

    Dan Williams
    Solution Consultant
    Bentley Systems, Incorporated
    Portland, OR, USA (Pacific Time UTC-08:00)

    Answer Verified By: John Drsek 

Reply
  • Another example of "words get in the way".

    The documentation for aaApi_LoginDlgExt() says:

    This function presents the Administrative ProjectWise login dialog. 

    It does not say "performs an administrative login", i.e. it just uses the dialog box that can perform an administrative login!  Certainly easy to misinterpret!!

    The key to how it is used is controlled by the values passed via the ulFlags parameter, which is not well documented.  If you click on the link to Login Dialog Style Flags there isn't anything listed (in the version that I am using) other than this less than helpful message:

    This structure is used to specify login information. More... 
     
    This structure is used to specify login information
    

    The first topic I cover in the ProjectWise SDK training class is "how to use help".  The point of the exercise is to learn some of the peculiar ways of the help documentation such as understanding that legacy names remain in use for some API terms such as project, vault, folder, and rich project, are all "folders" in ProjectWise, with the first three are used because when those functions were introduced, that was the name in use for what we now call "folders", and the last term, "rich project", was a way around the fact that "project" was already in use when ProjectWise Projects were introduced (now renamed to "Work Areas").

    In any case, the trick in this case is t to search the .h and .fdf files for clues.  If you search for "login" or "aaApi_LoginDlgExt", etc., you will eventually come across this in aawddef.h:

    #define AALOGIN_ADMINISTRATIVE            0x00010000L       /**< Admin login is performed. */
    #define AALOGIN_HIDE_SSO_GROUP            0x00020000L       /**< Hides extra check boxes of login dialog. These include SSO ("Use Windows credentials...")
                                                                     and auto-login ("Auto-login to this datasource") check boxes. Even if auto-login check box
                                                                     is hidden, automatic login will continue to work, but its configuration through login dialog
                                                                     will be unavailable. */
    #define AALOGIN_FILTER_DATASOURCE_LIST    0x00040000L       /**< Datasource selection drop-down list control will only list the datasources,
                                                                     to which there are no connections created yet. Datasources, to which
                                                                     application has connections, will be filtered out.*/
    #define AALOGIN_NO_AUTOLOGIN              0x00080000L       /**< Disables automatic-login. When set, automatic login
                                                                     configuration check box will be hidden too. */
    #define AALOGIN_INFO_ACTIVATE             0x01000000L       /**< Datasource handle already exists and datasource
                                                                     activation should be performed instead of login.
                                                                     \note This flag is for internal login operations and
                                                                     is not valid for aaApi_LoginDlgExt(). */
    #define AALOGIN_ADMIN                     0x02000000L       /**< Administrative login should be performed.
                                                                     \note This flag is for internal login operations and
                                                                     is not valid for aaApi_LoginDlgExt(). */
    #define AALOGIN_PASSWD_DONT_VERIFY        0x04000000L       /**< Don't verify the supplied password (datasource create)
                                                                     \note This flag is for internal login operations and
                                                                     is not valid for aaApi_LoginDlgExt(). */
    #define AALOGIN_NO_WORKING_DIR_VERIFY     0x08000000L       /**< Don't verify that the user's working directory exists.
                                                                     \note This flag is for internal login operations and
                                                                     is not valid for aaApi_LoginDlgExt(). */
    #define AALOGIN_DATASOURCE_AS_SERVER      0x10000000L       /**< Regard Datasource Name as Server Name.
                                                                     \note This flag is only for login server to validate authority. */
    

    Looking carefully, you can see both AALOGIN_ADMINISTRATIVE and AALOGIN_ADMIN, but the comments indicate the AALOGIN_ADMIN is for "internal login operations and is not valid for aaApi_LoginDlgExt()".

    OK, so how does this work?

    This bit of code will let any user log in, but none of the administrative functions are available:

            // login
            if (IDOK==aaApi_LoginDlgExt (NULL, L"Custom Login", 0,
                szDSource, sizeof(szDSource)/sizeof(WCHAR), szUser, szPassword, NULL))
            {
                TRACE (L"Login successful!\n");
                bLoggedIn = TRUE;
                this->m_ptrButLogin.SetWindowTextW (L"LogOut");
                return;
            }
            else
            {
                TRACE (L"Login canceled or aborted!\n");
                bLoggedIn = FALSE;
                this->m_ptrButLogin.SetWindowTextW (L"Login");
                return;
            }
    

    And this bit of code will only let ProjectWise administrators log in, and the session will have access to the administrative functions as well as to the non-administrative functions in the API.

            // login
            if (IDOK==aaApi_LoginDlgExt (NULL, L"Custom Login", AALOGIN_ADMINISTRATIVE,
                szDSource, sizeof(szDSource)/sizeof(WCHAR), szUser, szPassword, NULL))
            {
                TRACE (L"Login successful!\n");
                bLoggedIn = TRUE;
                this->m_ptrButLogin.SetWindowTextW (L"LogOut");
                return;
            }
            else
            {
                TRACE (L"Login canceled or aborted!\n");
                bLoggedIn = FALSE;
                this->m_ptrButLogin.SetWindowTextW (L"Login");
                return;
            }
    

    And yes, I fully agree, the documentation could be better!

    Looking again at the documentation, if you look at the deprecated function aaApi_AdminLoginDlg(), you will see this:

    This function presents the Administrative ProjectWise login dialog. 
    
    This function attempts to silently log-in the specified administrative user to the specified datasource. If the login attempt fails, the login dialog is shown and the user is offered to perform custom login himself. This behavior is equal to aaApi_LoginDlgExt() with the AALOGIN_SILENT and AALOGIN_ADMINISTRATIVE flags on.
    
    Automatic login functionality is unavailable in login dialogs shown by this function. This is because silent login implicitly disables automatic login.
    

    Hope this helps!

    Dan Williams
    Solution Consultant
    Bentley Systems, Incorporated
    Portland, OR, USA (Pacific Time UTC-08:00)

    Answer Verified By: John Drsek 

Children
No Data