I know we can modifiy the XData Class but here are a few addtional attributes may make default class a little more complete :
Last-Logoff
Last-Logon
Phone-Fax-Other
Phone-Home-Other
Phone-Home-Primary
Phone-Mobile-Other
Phone-Mobile-Primary
Phone-Office-Other
Social Attributes
ProfileUrl
LinkedInUrl
TwitterUrl
InstagramUrl
FacebookUrl
wlandgraf
(Wagner Landgraf)
June 21, 2022, 11:23am
2
Yes, the suggested approach is to inherit from TUser
and create your own TMyUser
class with the additional properties you need. Sphinx provides the core for the authorization/authentication process to function, and then you can extend it to add your own specific business information to it.
2 Likes
Any chance of a demo to show the best way to implement this?
wlandgraf
(Wagner Landgraf)
November 16, 2022, 2:58pm
4
All you have to do is set the property in TSphinxConfig
component:
SphinxConfig1.UserClass := TMyUser;
And then declare your TMyUser
class inheriting from TUser
:
uses
Bcl.Types.Nullable,
Aurelius.Mapping.Attributes,
Sphinx.Consts,
Sphinx.Entities;
{$RTTI EXPLICIT METHODS([vcProtected..vcPublished])}
[Entity]
[Model(cSphinxModelName)]
[DiscriminatorValue('myuser')]
TMyUser = class(TUser)
strict private
[Column('profile_url', [], 255)]
FProfileUrl: NullableString;
public
property ProfileUrl: NullableString read FProfileUrl write FProfileUrl;
end;
If you want to have a multi-tenant authorization server, you can also add the following unique key attribute:
[UniqueKey('user_name, tenant_id')]
[UniqueKey('email, tenant_id')]
[UniqueKey('phone_number, tenant_id')]
1 Like
I'd missed that. You think of everything, thank you.
1 Like
system
(system)
Closed
November 16, 2022, 8:57pm
6
This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.