Aurelius Classes for Sphinx

Are there any Aurelius classes available for Sphinx that we can start datamoduling with especially on the user and access rights parts?

I'm afraid I didn't understand your question, exactly.
Sphinx does use Aurelius to save and retrieve user data from database, and indeed it has some Aurelius entities declared in its source code to accomplish that. But I'm not sure what you are asking, exactly?

Just preparing my databases for my XData Server that will be containing my users and want to make sure I have primary keys and field lengths for things like user names, email and at correct data lengths.

In case it helps, here is the current TUser entity declaration:

  [DiscriminatorColumn('user_type', TDiscriminatorType.dtString, 255)]
  [FilterDef('Multitenant', '{TenantId} = :tenant_id')]
  [FilterDefParam('Multitenant', 'tenant_id', TypeInfo(string))]
  [Id('FId', TSmartGuid36LowerGenerator)]
  TUser = class
  strict private
    [Column('id', [TColumnProp.Required], 36)]
    FId: string;

    [Column('user_name', [], 255)]
    FUserName: NullableString;

    [Column('email', [], 255)]
    FEmail: NullableString;

    [Column('email_confirmed', [])]
    FEmailConfirmed: NullableBoolean;

    [Column('phone_number', [], 255)]
    FPhoneNumber: NullableString;

    [Column('phone_number_confirmed', [])]
    FPhoneNumberConfirmed: NullableBoolean;

    // number of failed login attempts for the current user.
    [Column('access_failed_count', [])]
    FAccessFailedCount: NullableInteger;

    // Gets or sets a flag indicating if the user could be locked out.
    [Column('lockout_enabled', [])]
    FLockoutEnabled: NullableBoolean;

    // Gets or sets the date and time, in UTC, when any user lockout ends.
    [Column('lockout_end', [])]
    FLockoutEnd: NullableDateTime;

    // a salted and hashed representation of the password for this user
    [Column('password_hash', [])]
    FPasswordHash: TBlob;

    // a random value that must change whenever a users credentials
    // change (password changed, login removed)
    [Column('security_stamp', [], 255)]
    FSecurityStamp: NullableString;

    [Column('revision', [TColumnProp.Required])]
    FRevision: Integer;

    [Column('tenant_id', [], 36)]
    FTenantId: NullableString;

    [ManyValuedAssociation([TAssociationProp.Lazy], CascadeTypeAllRemoveOrphan)]
    [ForeignJoinColumn('user_id', [TColumnProp.Required])]
    FTokens: Proxy<TList<TUserToken>>;

    [ManyValuedAssociation([TAssociationProp.Lazy], CascadeTypeAllRemoveOrphan)]
    [ForeignJoinColumn('user_id', [TColumnProp.Required])]
    FClaims: Proxy<TList<TUserClaim>>;

    [ManyValuedAssociation([TAssociationProp.Lazy], CascadeTypeAllRemoveOrphan, 'FUser')]
    FUserRoles: Proxy<TList<TUserRole>>;
  strict private
    function GetTokens: TList<TUserToken>;
    function GetClaims: TList<TUserClaim>;
    function GetUserRoles: TList<TUserRole>;
  strict protected
    [OnUpdating] procedure OnUpdating(Args: TUpdatingArgs);
    constructor Create;
    destructor Destroy; override;
    procedure UpdateSecurityStamp;
    function HasPassword: Boolean;
    function DisplayId: string;
    function DisplayName: string;
    property Id: string read FId write FId;
    property UserName: NullableString read FUserName write FUserName;
    property Email: NullableString read FEmail write FEmail;
    property EmailConfirmed: NullableBoolean read FEmailConfirmed write FEmailConfirmed;
    property PhoneNumber: NullableString read FPhoneNumber write FPhoneNumber;
    property PhoneNumberConfirmed: NullableBoolean read FPhoneNumberConfirmed write FPhoneNumberConfirmed;
    property AccessFailedCount: NullableInteger read FAccessFailedCount write FAccessFailedCount;
    property LockoutEnabled: NullableBoolean read FLockoutEnabled write FLockoutEnabled;
    property LockoutEnd: NullableDateTime read FLockoutEnd write FLockoutEnd;
    property PasswordHash: TBlob read FPasswordHash write FPasswordHash;
    property SecurityStamp: NullableString read FSecurityStamp write FSecurityStamp;
    property Revision: Integer read FRevision;
    property Tokens: TList<TUserToken> read GetTokens;
    property Claims: TList<TUserClaim> read GetClaims;
    property UserRoles: TList<TUserRole> read GetUserRoles;
    property TenantId: NullableString read FTenantId write FTenantId;

Thanks! I will make sure my user_name and email are 255 char also is the " id " field a GUID?

Yes, according to the mapping, it's a TSmartGuid36LowerGenerator, which means it's a 36-length GUID (no brackets, no dashes), in lowercase.

Interesting, I will try Sphinx

1 Like