The Identity object is an implicit interface that is implemented by every persistence object in your application that has a @Role annotation. This object has the following implicit declaration:
Attributes of the Identity object are automatically populated from the information users update on their profiles. You see this profile screen when you exit the app by clicking on "More Apps" on the right-hand corner mouseover menu. These details apply server wide, and are not app specific.
Outside of above context, the Identity object and all of its attributes are read-only.
Accessing Identity Attributes from Custom Objects
When displaying a system administrator's details (see Lesson 2 and Lesson 3), we'll give precedence to a user's profile information (which they would have entered themselves) over the values entered when they were invited. Since all persistent custom objects with @Role annotations implement the Identity object we can access the Identity attributes directly from such custom objects.
We can therefor change the SystemAdminUserMgmt unit and SystemAdminUserDetails view as below to check first if the user has entered a name and/or surname on his profile, and if so, display that instead.
Accessing Identity Attributes from the Identity Object
As mentioned earlier, the Identity object is read-only. It cannot be directly instantiated by Identity:new(). However, the compiler can implicitly convert any custom persistent object with a @Role annotation to an Identity object instance. The following changes to SystemAdminUserMgmt would haveachieved the same as the previous approach:
0 Comments