Migrating to WebHare 5.8 WRDAuth
For new applications:
- Prefer
WRD_PERSONfor your accounttype andWHUSER_LOGIN,WHUSER_PASSWORDWHUSER_LASTLOGINandWRD_CONTACT_EMAILfor logginame, password(authesettings), email and lastlogin respectively. We're considering requiring (some of) these values in the future to reduce wrdauth's complexity
Things to do/check:
<password>fields in WRD schema definitions should become<authenticationsettings>
If you want to have WRDAuth handle disabled accounts:
- Add
accountstatus="active inactive blocked required"to<schemadefinition. Add only the statusses you intend to use, and addrequireto ensure new entities have awrdauthAccountStatusvalue- If you add
wrdauthAccountStatuson an existing schema you may need to run a migration to re-activate all existing users.
- If you add
Example:
<?wh
LOADLIB "mod::system/lib/database.whlib";
LOADLIB "mod::wrd/lib/api.whlib";
OBJECT trans := OpenPrimary();
OBJECT wrdschema := OpenWRDSchema("<modulename>:<schemaname>");
INTEGER ARRAY userids := SELECT AS INTEGER ARRAY wrd_id FROM wrdschema->^wrd_person->RunQuery(
[ outputcolumns := CELL[ "wrd_id", "password", "wrdauth_account_status" ]
]) WHERE RecordExists(password) AND NOT RecordExists(wrdauth_account_status);
trans->BeginWork();
FOREVERY( INTEGER userid FROM userids )
wrdschema->^wrd_person->UpdateEntity(userid, [ wrdauth_account_status := [ status := "active" ] ]);
trans->CommitWork();