API Help
EPLAN API / User Guide / API Miscellaneous / Query user rights
In This Topic
    Query user rights
    In This Topic

    EPLAN can combine user interactions with certain rights. This is done by the EPLAN module "Rights management". If this module is not available or not licensed, the rights management is not active in EPLAN. The following screen shot shows the rights management dialog with a list of rights. 

     

     

     

    In your API application, you can find out, whether the rights management module is active and you can query the status of a given user right. The following example checks the user right for "XPLEditorStart", using the checkUserRights and the checkRightFor method. 

    UserRights oUserRights = new UserRights();
    bool bRights = oUserRights.CheckUserRights();
    if (bRights)
    {
         bool bAnRight= oUserRights.CheckRightFor("XPLEditorStart");
         if (bAnRight)
         {
           new Decider().Decide(EnumDecisionType.eOkDecision, "You have the right to call XPLEditorStart!", "", EnumDecisionReturn.eOK, EnumDecisionReturn.eOK);
         }
         else
         {
           new Decider().Decide(EnumDecisionType.eOkDecision, "You don't have the right to call XPLEditorStart!", "", EnumDecisionReturn.eOK, EnumDecisionReturn.eOK);
         }
    }
    else
    {
        new Decider().Decide(EnumDecisionType.eOkDecision, "This application works without rights management!", "", EnumDecisionReturn.eOK, EnumDecisionReturn.eOK);
    }
    
    Dim oUserRights As New UserRights()
    Dim bRights As Boolean = oUserRights.CheckUserRights()
    If bRights Then
       Dim bAnRight As Boolean = oUserRights.CheckRightFor("XPLEditorStart")
       Dim message as Decider = New Decider
       If bAnRight Then
        new Decider().Decide(EnumDecisionType.eOkDecision, "You have the right to call XPLEditorStart!", "", EnumDecisionReturn.eOK, EnumDecisionReturn.eOK)  
       Else
        message.Decide(EnumDecisionType.eOkDecision, "You don't have the right to call XPLEditorStart!", "", EnumDecisionReturn.eOK, EnumDecisionReturn.eOK)
       End If
    Else
        message.Decide(EnumDecisionType.eOkDecision, "This application works without rights management!", "", EnumDecisionReturn.eOK, EnumDecisionReturn.eOK)
    End If
    

     

    For information about the rights available in EPLAN and about their assignment to the users, please refer to the rights management dialog. You cannot add new user rights via API.