Addtional Attributes for User Class

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

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?

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

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.