ITQuants blog

SphRisque: how to add and use specific rights?

Mar 14

Written by:
3/14/2014 6:10 PM  RssIcon

On Sophis Risque and Value, it is possible to add specific user rights, by adding tabs on user/group configuration. Tabs and fields are added using the Oracle table USER_RIGHT_TABLE. On previous versions of Sophis, such rights were defined using C++ toolkit and the obsolete class CSRUserRights.

For example, this query adds a specific right, that can be selected after in the user/group configuration.

insert into user_right_table(name,category,internal_right,right_type,right,idx,comments) select 'SwapOne Save','MyBank',0,2,-1,max(idx)+1,'SwapOne rights' from user_right_table;


Once defined and configured on some users, it can be used, for example on CSRInstrumentAction::VoteForModification, using the following code:

CSRUserRights _user;
bool _canSave = _user.GetIdent()==1;
if(!_canSave) // all rights on Manager
{
    const char* _rightName = "SwapOne Save";
    eRightStatusType _right(_user.GetUserDefRight(_rightName));
    if(_right==rsSameAsGroup)
    {
        CSRUserRights _group(_user.GetGroupID());
        _group.LoadDetails();
        _right = _group.GetUserDefRight(_rightName);
    }
    if(_right==rsEnable)
        _canSave = true;
}
if(!_canSave)
    throw(VoteException("Modifications on Swap One instruments are forbidden"));


Search blog