ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

New WEBDEV 28 feature!
  • In this lesson you will learn the following concepts
  • Overview
  • Integrating the User Groupware
  • Configuring the User Groupware
  • Including the customer section in the site
  • Site test
  • Creating users and groups
  • Defining rights
  • Site test
  • Disabling the User Groupware
Lesson 5.4. User login: User Groupware
In this lesson you will learn the following concepts
  • What is the User Groupware?
  • Integrating the User Groupware.
  • Configuring the User Groupware.
  • Testing the User Groupware.
Lesson duration

Estimated time: 20 mn
Previous LessonTable of contentsNext Lesson
Overview
A site can be used by different contributors with different profiles. It is sometimes necessary to define different access levels according to the user (customer, salesman, manager, etc.).
Let's take a simple example: an e-commerce website that allows users to do the following:
  • View prices,
  • Modify prices,
  • Enter orders,
  • Manage customers.
Accesses are different according to the user. For example:
  • customers can see the price list and place orders.
  • salesmen can see the price list, place orders and create new customers.
  • managers have access to all the options.
WEBDEV allows you to manage these different access levels via the User Groupware.
We will enable the User Groupware in our "Full_WEBDEV_Site" site and configure it to limit the access to the page for adding products.
  • Open the project you worked on in the previous lesson.
    1. Go to the WEBDEV home page (Ctrl + <).
    2. On the home page, click "Tutorial", then in "Parts 3 to 6", double-click "Full WEBDEV Site (Exercise)".
    3. A dialogue box prompts you to open the project you worked on in the previous lesson. You can open the local copy or the original project. Select "Open the local copy".

Answers

A completed project is available. This project allows you to follow this lesson. To open the completed project, go to the home page and click "Tutorial", then in "Parts 3 to 6", double-click "Full WEBDEV Site (Answers)".
Integrating the User Groupware
  • To enable the User Groupware in the "Full_WEBDEV_Site" project:
    1. On the "Project" tab, in the "Project" group, click "User Groupware". The configuration window of the current platform opens on the "GPU / Private Store" tab.

      Note

      The User Groupware can be set up for only one of your project configurations. When testing the project, the User Groupware connection window will only be displayed when testing the platform for which the groupware has been enabled.
    2. In "User Groupware", click "Change".
    3. The User Groupware configuration window is displayed. Enable the User Groupware by clicking "Enabled".
    4. Select "Standard User Groupware" and "Manual start via a control template".
      User Groupware settings

      Note

      When the User Groupware is in "Automatic start" mode, a standard log in page appears. If users enter their usernames and passwords, they are allowed to access the site.
      When the User Groupware is in "Manual start via a control template" mode, the developer can use a specific control template. This control template can be used to insert a link into the page to allow users to log in. We will present this solution in this lesson since it is easy to use and adapt.
    5. Validate. A message is displayed, indicating that an administrator account is created by default.

      Note

      The supervisor is the default user. The first time you log in to the site, enter: "supervisor" as username and password.
    6. Validate this message.
    7. Validate the project configuration window. The User Groupware has been enabled in the project.

      Note

      In this example, we will keep all the default options. Several options can also be configured.
      For more details, see User Groupware: Options and settings.
Configuring the User Groupware
The User Groupware is configured when running the site. This configuration consists in defining the different users as well as their rights on the site pages and controls.

Note

The users can be configured:
  • when developing the application. The necessary data files (regarding the users and their rights) can be installed with the site.
  • when the administrator installs the site.

Including the customer section in the site

In this example, we will add the log in link to "PAGE_List_of_products".
The log in link is provided as a control template.

Note

A control template is a specific page containing several controls. This page can contain all types of controls. Control templates use the "WDT" file extension.
The main advantage of using a control template is that it can be easily reused. A control template can be reused in any page of the project. You only need to make changes once and WEBDEV automatically applies them on all the pages that use the control template.
Control templates can be overridden: code can be added, the controls can be moved in the page that uses the control template. Controls can also be modified.


  • To add the log in link:
    1. Open the "PAGE_List_of_products" page in the editor.
    2. Go to the "Project explorer" pane, "Internal components", and expand "WDGPU_WB_CNT". This internal component was included in the project when enabling the Groupware. It contains all the necessary elements, especially the control template used to log in.
    3. Then, expand "WEBDEV control templates".
      User Groupware in the 'Project explorer' pane
    4. Select the TPLC_GPU_WB_Login control template and drop it onto PAGE_List_of_products. Drop the control template above the menu bar.
      Drag and drop control template
    5. The control template is successfully included. The "Log in" link appears.

Site test

  • Let's test our site:
    1. Test the project (click Test project in the quick access buttons).
    2. The page corresponding to the list of products is displayed.
    3. Click the "Log in" link. The log in page is displayed.
    4. Log in as supervisor:
      • Username: supervisor
      • Password: supervisor
    5. Validate.
    6. The Groupware configuration page appears.
      User Groupware test

Creating users and groups

To configure the User Groupware, we are going to create a "Product Management" group. This group will include the users who are allowed to modify and add products in the site.
Then, we will create a user named Alison and associate it with the "Product Management" group.

  • To create a new group of users:
    1. Click the "Groups" tab.
    2. Click "Add a group". The screen for entering a new group is displayed.
    3. Type the group name: "Product Management".
    4. Click "Save". The "Product Management" group appears in the list of groups defined in the User Groupware.
  • To create a user:
    1. Click on the "Users" tab.
    2. Click on "Add a user". The screen for entering a new user is displayed.
    3. Enter the following information:
      • Username: Alison
      • First name: Alison
      • Select "Force the following password" and enter the password: Alison.
        Remark: You can also let users choose their passwords the first time they log in.

        Note

        User information:
        • In the user information, only the username is mandatory.
        • You can also set a user as Groupware supervisor. In this case, the supervisor will be able to modify users, groups and rights.
    4. Click "Save". "Alison" appears in the list of users defined in the User Groupware.
  • To associate "Alison" with the "Product Management" group:
    1. Select "Alison" in the page.
    2. Check the box at the beginning of the row: the buttons "User groups" and "Delete user" appear.
    3. Click "User groups".
    4. In the popup that appears, check "Product Management" and click "OK".
    5. The association is completed. The name of the group to which "Alison" is associated appears in the list of users.

Defining rights

We will now define the access rights to the menu for adding a product.
It is recommended to refuse default access and allow selected groups only.
  • We will define the rights for users who haven't logged in (i.e., not identified by the Groupware). These rights will be used by default when starting the site, as long as the user isn't logged in.
  • Define the rights:
    1. To prevent all users from accessing the page used to add products, select the "Visitor (not connected)" user. Any user who is not logged in is automatically associated with this user.
    2. Click to set the rights.
    3. The page that appears allows you to select each page, page template or report of the application.
      • For each page, page template or report, it is possible to specify whether or not the element will be accessible to the user or group previously selected.
      • For each page or page template, you can define whether the controls will have the site behavior (default) or whether they will be inactive, invisible or grayed.
  • In our case, the "Add a product" link is in the "PAGETPL_Menu" page template:
    1. Select the "PAGETPL_Menu" page template from the list. The rights defined on the page template will be applied to all the pages that use the template.
    2. The names of the different page controls appear on the right.
    3. For "Menu option Option_2", select "Grayed" in the "State" combo box.
    4. Close the browser.

Site test

  • We will test the site.
    1. Test the project (click in the quick access buttons).
    2. By default, the "ADD A PRODUCT" option is grayed out.
    3. Click "Log in" and enter "Alison" in the username and password fields. Validate.
    4. The "ADD A PRODUCT" option is no longer grayed out.
    5. Close the browser.
Disabling the User Groupware
The User Groupware will no longer be used in the rest of this tutorial. You can disable the management of user rights in this project and remove the control template we used:
  1. On the "Project" tab, in the "Project" group, click "User Groupware".
  2. The platform configuration window appears.
  3. In "User Groupware", click "Change".
  4. In the window that appears, click "Disabled".
  5. Validate.
  6. If necessary, open "PAGE_List_of_products".
  7. Delete the "Log in" control template we added previously.
  8. Save and close the page.
  9. Recompile the project: on the "Project" tab, in the "Project" group, expand "Recompile and synchronize" and select "Recompile project and generate HTML pages".
  10. Go to the "Project explorer" pane, expand "Internal components" and select "WDGPU_WB_CNT". Right-click to open the context menu and select "Remove and delete from disk".
  11. Validate the message that appears.
The User Groupware is removed from the project.
Previous LessonTable of contentsNext Lesson
Minimum version required
  • Version 28
Comments
Click [Add] to post a comment