Restricting your EPDM addin

There are a lot of API snobs out there who feel their SOLIDWORKS Enterprise PDM code is too good to be run by just anyone, perhaps only members of a certain user group are allowed to run their precious code.

Perhaps they are writing something that should only be run by administrators.

I personally am a programmer for the people; but if you are related to Marie Antoinette, it is pretty easy to accomplish this act of discrimation. You include an “if-then” statement, like the one below, in your addin’s “GetAddInInfo” routine and you’ll be eating cake in no time.

If AllowedUser(poVault) = True Then
poCmdMgr.AddCmd(1, "Name of the special function", EdmMenuFlags....)
End If

You’ll need to write an “AllowedUser” function that can use the vault object parameter to return TRUE if this person is royalty or FALSE if this is a “commoner”.

Commoners will never even see your routine in their right mouse click.

Remember the “GetAddInInfo” routine is only run once – when you first log into the vault. If a user suddenly becomes an “allowed” user, he’ll have to reload his Windows Explorer process to see the change.

  • Share this
Find Your Design Solution in the CATI Store.
Browse Products