![]() |
|
Published 1997-10-01 Printer-friendly version
Sometimes I have a client who has a rather complex security need. Depending on the security level of the person logging on, a person may be authorized to do one or more of the following:
Since the set of approved authorizations varied quite a bit, I wanted to set up a simple way of handling this security.
During the login process, the user enters a name and password. Associated with
an approved password is a security level. I stored this value in a global value,
g:SecLevel. Appropriate values were predefined as:
Setting up the value of g:SecLevel is outside the scope of this article. But the rest of the article assumes that the value has been set.
After putting in several security violation messages, I wrote a template which in essence says the following:
Each security violation calls this one procedure. I built a template to create this procedure so it only needs to exist once in the application.
I then wanted a simple button security template which I could put into the embed code. It would use the above predefined security levels and the g:SecLevel value. In the embed point it looks like this:
#TEMPLATE(SMPL0003,'Simple Button Security')
#!---------------------------------------------
#! Security Message Procedure
#!---------------------------------------------
#PROCEDURE(SecMsg,'Security Message Procedure')
#DISPLAY('')
#DISPLAY('This message displays if security is')
#DISPLAY(' inadequate.')
#DISPLAY('')
#LOCALDATA
Loc_Msg String('Option not authorized at your security level')
#ENDLOCALDATA
%Procedure %ProcedureType
#FOR(%LocalData)
%[20]LocalData %LocalDataStatement
#ENDFOR
CODE
IF MESSAGE(Loc_Msg,'Security',Icon:Exclamation,Button:OK,Button:Ok,0).
#!----------------
#! Button security
#!----------------
#CODE(ButtonSecurity,'Regular Button Security')
#DISPLAY('')
#DISPLAY(' This should be embedded in')
#DISPLAY(' Control Event Handling')
#DISPLAY(' Before Generated Code')
#DISPLAY(' ')
#DISPLAY(' This routine uses g:SecLevel')
#DISPLAY(' ')
#PROMPT('Do not execute if Security Level',Option),%LevelCheck
#PROMPT('=3',Radio)
#PROMPT('=2',Radio)
#PROMPT('>1',Radio)
IF g:SecLevel %LevelCheck
SecMsg
CYCLE
END !If
Use of the above two template sets allows a simple button security to be implemented very quickly. Its simplicity creates an ease of communication with the end user in determining who should do what. Making appropriate modifications to the templates could create even more complex security scenarios.
Copyright © 1999-2008 by CoveComm Inc. All Rights Reserved. Reproduction in any form without the express written consent of CoveComm Inc., except as described in the subscription agreement, is prohibited.
Clarion Magazine ISSN 1718-9942
One year: $184
(includes all back issues since '99)
Renewals from $134
Two years: $274
Renewals from $224