Skip to content

The sample shows how to use session attributes in a CUBA application

License

Notifications You must be signed in to change notification settings

aleksey-stukalov/session-attributes

Repository files navigation

session-attributes

This sample is developed in response to the following questions on the CUBA support forum:

  1. https://www.cuba-platform.com/support/topic/company-selector-in-main-window
  2. https://www.cuba-platform.com/discuss/t/extend-user-of-cuba-platform-with-new-attribute-manager/3213

Data Model

The application contains the BusinessUser enity, that refers to the system User, which comes along with CUBA and used for security and auth purposes. A business user also encapsulates additional information that is used by the business logic of your CUBA application. In this sample it has an additional reference to the Company enity.

Functional Overview

The application retrieves information about the related business user for a logged-in user and adds it into the session attribures, so it can be taken from it at any time. Find the implementation of this part here, it handles the UserLoggedInEvent event and add the required session attribute.

In the main screen implementation contains an example of how you can access this session attribute from the controller. It sets a lookup field (in the top right corner) to a value, that is saved in the business user coming from session attributes.

Useful Links

  1. Read about the global application login actions in the official documentation. Find how to hook the events here and how it is implemented in this project here.
  2. Learn how to manipulate with the session attributes by reading this chapter of the docs.
  3. Find information on how to extend the main screen here or just click a few times in the CUBA Studio and it will scaffold an extension for the main screen for you.
  4. Find another way of extending the system user entity in this sample.

About

The sample shows how to use session attributes in a CUBA application

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages