Get userlist with complete userinformation of registered users
Added by Louis Hoefler about 8 years ago
Hello Everyone,
i currently try to modify the Blog example userlist.
I try to implement a advanced user editor, which allows me to change the unique userid as well.
I removed the "name" field and try get the userlist by "identity".
However after modifying the "name" member to "identity" i get this error:
view/EditUsers.C:65:34: error: ‘const class User’ has no member named ‘identity’
bindString("username", target_->identity);
Can someone explain how I can build a list of userinformation which includes the default Auth data (like identity and mail etc.).
Would I have to use [[[http://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1Auth_1_1Dbo_1_1UserDatabase.html]]] ?
Example code would be much appreciated, becouse I am new to Wt.
Thank you, Louis
Replies (2)
RE: Get userlist with complete userinformation of registered users - Added by Louis Hoefler about 8 years ago
This does what I want, however I dont know weather this is the right way to do it, more information would be great, thank you.
for(UserList::const_iterator i = users.begin(); i != users.end(); ++i) {
dbo::ptr<AuthInfo::AuthIdentityType> id = session_.find<AuthInfo::AuthIdentityType>().where("id = ?").bind((*i).id());
WText* t = new WText(id->identity(), list);
t->setStyleClass("link");
new WBreak(list);
t->clicked().connect(boost::bind(&EditUsers::onUserClicked, this, (*i).id()));
}
RE: Get userlist with complete userinformation of registered users - Added by Koen Deforche about 8 years ago
Rather than using the lower-level dbo objects, I would recommend to use the Wt::Auth interface:
http://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1Auth_1_1User.html
This is how you then can query the login name:
user.identity(Wt::Auth::Identity::LoginName);