3D PLM PPR Hub Open Gateway

Knowledge Modeler

Managing Parameter Rights

How to specify access rights on parameters
Use Case

Abstract

This article explains how to manage the parameter access rights.


What You Will Learn With This Use Case

The literal feature platform manages the parameter rights in two steps:

  1. By specifying access rights on the literal.
  2. Then by making the parameter editor process the specified accessed rights. That way, the end-user is only authorized to access parameters according to the rights specified.

In this use case, you will only learn how to specify access rights on parameters.

[Top]

The CAALifParameterRights Use Case

CAALifParameterRights is a use case of the CAALiteralFeatures.edu framework that illustrates KnowledgeInterfaces framework capabilities.

[Top]

What Does CAALifParameterRights Do

This use case creates two integer type parameters and set their access rights.

In a batch program which does not involve any parameter editor, you can specify access rights but they are not really active. To test the right access effectiveness. you must plug an editor to your application.

[Top]

How to Launch CAALifParameterRights

To launch CAALifParameterRights, you will need to set up the build time environment, then compile CAALifParameterRights along with its prerequisites, set up the run time environment, and then execute the use case which main program is CAALifParametersMain. This program encompasses several use cases [1].

[Top]

Where to Find the CAALifParameterRights Code

The CAALifParameterRights use case is made of the CAALifParameterRights.cpp file located in the CAALifParameters.m module of the CAALiteralFeatures.edu framework:

Windows InstallRootDirectory\CAALiteralFeatures.edu\CAALifParameters.m\
Unix InstallRootDirectory/CAALiteralFeatures.edu/CAALifParameters.m/

where InstallRootDirectory is the directory where the CAA CD-ROM is installed.

The main program related to this file is CAALifParametersMain.

[Top]

Step-by-Step

CAALifParameterRights is made up of xx steps:

  1. Creating the Parameters
  2. Retrieving the Default Access Rights
  3. Setting the Access Rights

[Top]

Creating the Parameters

The "intParam0" and "intParam1" parameters are created as persistent parameters [2].

[Top]

Retrieving the Default Access Rights

The default parameter rights are retrieved by using the CATICkeParm::UserAccess method.

CATICkeParm_var spP1 = ... ; 
cout << "Default rights (3 expected - readOnly)" << endl;
cout << int(spP1->UserAccess ()) << endl;
cout << "Default rights (0 expected)" << endl;
cout << int(spP1->IsReadOnly () ) << endl;

By default a parameter is created with ReadWrite access mode. The access rights are defined by the enum below:

enum UserAccessMode
{
  NotSeen = 0,
  ReadOnly = 1,
  WriteOnly = 2,
  ReadWrite = 3,
  User = 4
}

In addition to the usual access rights, the literals support the NotSeen access right whereby you can specify that a parameter can only be used by the application developer. The NotSeen access right has nothing to do with the Hidden properties which is managed by the end-user.

You can also use the CATICkeParm::IsReadOnly method to determine the parameter access rights.

[Top]

Setting the Access Rights

...
spP1->SetUserAccess(ReadOnly);
spP2->SetUserAccess(ReadOnly);
...

The "intParam0" access right is set to ReadOnly by using the CATICkeParm::SetUserAccess method which takes as its argument one of the items of the UserAccessMode enum.

The "intParam0" parameter is constrained by the p1 = 3 * p2 - 2 formula although it is declared as a ReadOnly parameter. The formula is created and the "intParam0" parameter is updated according to the formula.

[Top]


References

[1] Building and Launching a CAA V5 Use Case
[2] Using Persistent Parameters
[Top]

History

Version: 1 [Jan 2000] Document created
[Top]

Copyright © 2000, Dassault Systèmes. All rights reserved.