|
|
|
|
|
- User authentication: User Groupware
- What is the User Groupware?
- Integrating the User Groupware
- Opening the example project
- Integrating the User Groupware into the project
- Integrating user authentication into the website
- Configuring the User Groupware
- Creating users and groups
- Defining rights
- Testing the page with a specific user
- Disabling the User Groupware
- To sum up
Tutorial - User Groupware
User authentication: User Groupware We will cover the following topics: - What is the User Groupware?
- Integrating the User Groupware.
- Configuring the User Groupware.
- Testing the User Groupware.
20 mn What is the User Groupware? A website 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.). 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 easily manage these access levels via the User Groupware. We are going to integrate the User Groupware into the "Site WEBDEV Complet" site and configure it.
Integrating the User Groupware Opening the example project This tutorial uses the "Full_WEBDEV_Site" project. This website will have a front office and a back office. We will configure the website to limit access to the add products page in the back office. Authentication via the User Groupware will be automatically implemented using a login link. Opening the example project - Go to the WINDEV home page (Ctrl + <).
- On the home page, click on "Tutorial", then in the "Tutorial - User Groupware" area, click on the "Open exercise project" link.
Integrating the User Groupware into the project First of all, to use the User Groupware in a website, you need to integrate it into your project. Follow these steps: - On the "Project" tab, in the "Project" group, click "User Groupware". The configuration window of the current platform opens on the "GPU" tab.
If you have multiple project configurations, the User Groupware can be configured for just one of them. The User Groupware login prompt will only appear when testing this configuration. - In "User Groupware", click "Change". The User Groupware configuration window appears.
- Enable the User Groupware by selecting "Enabled".
Configuring the User Groupware As you can see, the User Groupware settings window contains several tabs and numerous options. We will only describe the options used in this tutorial. - On the "General" tab, the "Standard User Groupware" option is selected by default. This option allows authenticating users directly from the website. That is the desired method in this tutorial. We will therefore keep this option.
- Select "Manual launch by field template": this option allows you to obtain a specific Link control field.. This link will allow users to access pages where authentication is required.
- Confirm and close the User Groupware settings window.
- A message appears indicating that an administrator account will be created the first time the application is run.
The supervisor is the default user. The first time you launch the application, you'll be able to set the password used by the supervisor. - Validate this message.
- Validate the project configuration window. The User Groupware has been enabled in the project. Various style errors appear. Let's fix them right away.
- First, update the skins used by the project: in the "Project" pane, in the "Project" group, pull down "Recompile and synchronize" and select "Update skins".
- Next, update the project styles: in the "Project" pane, in the "Project" group, pull down "Recompile and synchronize" and select "Update page styles".
- Update models: in the "Project" pane, in the "Project" group, pull down "Recompile and synchronize" and select "Model synchronization".
Integrating user authentication into the website Our project now supports the User Groupware, but users must be able to log in. In this example, we will integrate the login link into "PAGE_List_of_products". The log in link is provided as a control template. Definition: A control template is a specific page containing several controls. 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. For more details, see Control template. Let's integrate the login link into the page: - Open the "PAGE_List_of_products" page in the editor. You can press Ctrl + E and enter the name of the page.
- Go to the "Project explorer" pane, "Internal components", and expand "WDGPU_WB_CNT".
This internal component was included in the project when the User Groupware was enabled. It contains all the necessary elements, especially the control template used to log in. - Then, expand "WEBDEV control templates".
- Select the TPLC_GPU_WB_Login control template and drop it onto PAGE_List_of_products. Drop the control to the right of the Company logo.
- The control template is successfully included. The "Log in" link appears.
Configuring the User Groupware The User Groupware is configured when running the website. This configuration consists in defining the users and their rights on the pages and controls of the website. Users can be configured: - when developing the application. The necessary data files (regarding the users and their rights) can be installed with the website.
- when the administrator installs the website.
Let's test our page, which in turn, will allow us to configure users and rights. - Test the page (click in the quick access buttons).
- The page with the list of products is displayed.
- Click the "Log in" link. The login page is displayed.
- Log in as supervisor:
- Login: supervisor
- Password: supervisor
- Validate.
- On the page that appears, select "Configure groupware".
- The User Groupware configuration page appears.
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 edit and add products in the website. Then, we will create a user named Alison and associate it with the "Product Management" group.
To create a new group of users: - Click the "Groups" tab.
- Click "Add a group". The group creation window appears.
- Type the group name: "Product Management"
- Click "Save". The "Product Management" group appears in the list of groups defined in the User Groupware.
To create a user: - Click on the "Users" tab.
- Click "Add a user". The screen for entering a new user is displayed.
- Enter the following information:
- Login: Alice
- First name: Alice
- Select the "Force next password" option and enter the password: Alice.
Note: It is also possible to let the user choose a password on first login..
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.
- Click "Save". "Alison" appears in the list of users defined in the User Groupware.
To associate "Alison" with the "Product Management" group: - Select "Alison" in the page.
- Check the box at the beginning of the line: the "User groups" and "Delete user" buttons appear..
- Click "User groups".
- In the popup that appears, check "Product Management" and click "OK".
- 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 the website opens, as long as the user isn't logged in. Define the rights: - 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.
- Click to set the rights.
- 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 behavior defined by the website (default) or whether they will be inactive, invisible or grayed.
In our case, the "Product form" link is in the "PAGETPL_Menu" page template: - 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.
- The names of the different page controls appear on the right.
- For "Menu option OPT_AddProduct", select "Grayed out" in the "State" combo box.
- Close the browser.
Testing the page with a specific user We will now test the page. - Click in the quick access buttons.
- By default, the "Product form" option is grayed out.
- Click "Log in" and enter "Alison" in the username and password fields. Validate.
- The "Product form" option is no longer grayed out.
- Close the browser.
Disabling the User Groupware Other tutorials use the "Full_WEBDEV_Site" project, but they do not require you to enable the User Groupware. Let's disable it. You can disable the management of user rights in this project and remove the control template we used: - On the "Project" tab, in the "Project" group, click "User Groupware".
- The platform configuration window appears.
- In "User Groupware", click "Change".
- In the window that appears, click "Disabled".
- Validate.
- If necessary, open "PAGE_List_of_products".
- Delete the "Log in" control template we added previously.
- Save and close the page.
- Recompile the project: under the "Project" pane, in the "Project" group, pull down "Recompile and synchronize" and select "Recompile project and generate HTML pages".
- 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".
- Validate the message that appears.
The User Groupware is removed from the project. We discovered how to set up and use the User Groupware. We defined users and user groups, as well as their rights. We have completed this tutorial. Don't forget to close the current project: - On the "Home" tab, in the "General" group, expand "Close" and select "Close project".
- Save changes if necessary.
The WEBDEV home page appears.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|