cancel
Showing results for 
Search instead for 
Did you mean: 

How to prevent modifying any property by script in PD 16.5?

Former Member
0 Kudos

Is there any way, how can I prevent modifying any object property (e.g. Table Comment) by vbscript? I am able to prevent user from modifying it in GUI by validation handler, but it seems, that validation handler is not triggered when modifying objects by script. Is there any way how to achieve it? Is it a bug, that validation is not triggered when modifying objects by vbscript?

Thanks,

Ondrej

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member200945
Contributor
0 Kudos

Could you provide code? Event handler should work.

Sounds like you only want to assign users the right to view  model.

If this is the case, you can ask them go to Portal or use Powerdesigner Viewer

Former Member
0 Kudos

Hi Phillip, thanks for reply. PD Viewer is not the solution, because this customization is for standard PD users (=modifiers) and the goal is just prevent users from modifying property MappedTo (in TablaMappings and ColumnMappings) by script or manually through GUI. Meaning that users should only see the automatically generated code of MappedTo property, but should not be allowed to change it by any means. I succeeded to prevent them from modifying it through GUI, but still they are able to see it. But it seems to me, that Validate handler is not triggered when modifying by script. At least in PD 16.5.

I can provide the code, but the code of event handler is not the problem. The problem is, that the event handler is not even TRIGGERED, when the object is modified by script. You can simply put to your handler line:

output obj.Name + " validation."

And then you can run following code:

Dim t, m

For each t in activemodel.Tables

  If not t.isShortcut then

    For each m in t.Mappings

      output "old: " + m.MappedTo

      m.MappedTo = "new text"

      output "new: " + m.MappedTo

    Next

  End if

Next

And I don`t see, the output line from the validation handler in the output window...

This makes me think, that there is no way how you can make any property read-only even for scripting. Or am I wrong?

c_baker
Employee
Employee
0 Kudos

To play devil's advocate: I can see a huge problem in using an event handler to prevent changes to objects - beyond the possible performance aspects - when objects are changed by script.

That would be the need to alter ALL scripts (SAP-provided extensions as well) to handle the errors generated when an expected change is 'rejected'.

Another issue would be the possible inconsistent state that the model could be left in (e.g. transforms) should such events be triggered by a scripted change, while others are allowed.

For now, it might be better to use current repository security to prevent changes on check-in for certain users (package level for now), or use PD vierwer.

Perhaps a request can be made to extend the BaseObject or BasePackage (to match the repository) with a security model and to 'test' a scripted transaction first against security requirements before proceeding.  That way a global error check could fire and the transaction could be rolled back/prevented and perhaps solve the need, for now, to update all scripts to handle errors.

Chris

Former Member
0 Kudos

Chris, thanks for your reply. Perhaps you are right with the performance aspect. Regarding the error handling, PD script works as a transaction, meaning, if you run into an error during the script runtime, all changes done so far are rolled back automatically.

Neither repository permissions nor PD Viewer solve the problem. The users are experienced modellers who actually have to have write permissions for the whole model. The task here is to make one property completely read-only to them. Other properties must stay modifiable. It is the rule in the modelling of the customer and they want to enforce it in PD. Not just have it in the Word document.

I can take away the whole Edit/Run Script... function from the Tools menu, but that is too restrictive and brings so many disadvantages that I cannot use it.

Perhaps Matt Creason or Marc Ledier could help us with their knowledge.

Is there any way, how to disallow users from modifying one object property by vbscript, without taking them the possibility to modify other properties of such object?