Dynamic View Services > Implementing a Dynamic View Server and its Components > Overview > Subclassing IlsMvUser
 
Subclassing IlsMvUser
You may also need to use a subclass of IlsMvUser to attach information to connections or to enforce your own security policy.
An instance of IlsMvUser is associated with the unique instance of IlsMvComponentItf that represents the connection with an application component. IlsMvUser data members are assigned during the connection phase.
You can install an instance of IlsMvUserFactory to create your own type of IlsMvUser:
class MyUser : public IlsMvUser
{
public:
MyUser(const char* userName=0,
int userId=0,
const char* hostName=0,
const char* inetId=0,
int processId=0);
};
 
MyUser::MyUser(const char* userName,
int userId,
const char* hostName,
const char* inetId,
int processId)
: IlsMvUser(userName, userId, hostName, inetId, processId)
{
}
 
class MyUserFactory : public IlsMvUserFactory
{
public:
virtual IlsMvUser* getUser(const char* userName,
int userId,
const char* hostName,
const char* inetId,
int processId) {
return new MyUser(userName, userId, hostName, inetId, processId);
}
};
 
// in main function:
IlsMvUserFactory::SetSingleton(new MyUserFactory());
This user instance can be manipulated from the view:
...
represent TreeRp when (view.user.MyUser.isAllowed()):
...
The user can also be retrieved by calling the static member function IlsMvServer::GetInteractingUser while component-to-server transactions are processed.

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.