EPLAN.EPLAN21.LOGIN

Contents

Description

Command for switching the current user group.

The EPLAN.EPLAN21.LOGIN command is called up via the API functions as specified in the EPLAN 21 API.

Parameters

All parameters have the prefix "EPL_PARAM_LOGIN_".

ParameterID Type Description
ROLEID [IN], Integer

ID of the user group to which the current user group is to be switched. The roleID can be determined via the iterator EPL_ITERATOR_ROLES.

PASSWORD [IN], String

The password for the user group.

Error Messages

The eplExecuteCommand function returns EPL_OK if the user group could be correctly switched.

If the command fails, eplExecuteCommand returns the value EPL_ERROR. In this case, the error log can contain the following errors:

ErrorID Description
EPL_ERR_LOGIN_WRONG_PASSWORD The transferred password was not correct.

Example

The following example shows a function to switch to the user group "Administrator". The password for the user group is TEST. The roleID is determined via the iterator EPL_ITERATOR_ROLES.


const BUFLEN=20;

int
getRoleId(const wchar_t* roleName, wchar_t* roleId)
{
        wchar_t buf[BUFLEN];
        EplHandle roleIter = eplOpenIterator(s, -1, EPL_ITERATOR_ROLES);
        EplHandle role = eplFirst(s, roleIter);
        while(role != EPL_ERROR)
        {
                eplGetProperty(s, role, EPL_PROPERTY_GENE_NAME, 0, buf, BUFLEN);
                if(wcscmp(buf, roleName) == 0)
                {
                        eplGetProperty(s, role, EPL_PROPERTY_ROLE_ID, 0, roleId, BUFLEN);
                        return EPL_OK;
                }

                role = eplNext(s, roleIter);
        }
        eplCloseObject(s, roleIter)

        return EPL_ERROR;
}

EplHandle
login(EplSession s)
{
        wchar_t roleId[BUFLEN];
        if(getRoleId(L"Administrator", roleId) != EPL_ERROR)
        {
                EplHandle loginCommand = eplCreateCommand(s, L"EPLAN.EPLAN21.LOGIN");
                eplSetParam(s, loginCommand, EPL_PARAM_LOGIN_ROLEID, roleId, 0);
                eplSetParam(s, loginCommand, EPL_PARAM_LOGIN_PASSWORD, L"TEST", 0);

                ret = eplExecuteCommand(s, importCommand);
                eplCloseObject(s, loginCommand);
                return ret;
        }
}

Reference