Is there a way within Navision (short of codeing) to institute field level security within a table. For an example, we want to block certain users from viewing or changing specific fields in a table but allow acces to other fields.
Here is an example of something I did for a customer. You have to change the form in the OnOpenForm() trigger. It does require coding, so I guess I can't answer your question.
In this case twofields were added to User Setup, "Create Order" and "Clear Credit Hold". Depending on the user, certain fields will be set as not editable.
IF UserSetup.GET(USERID) THEN BEGIN
IF NOT UserSetup."Create Order" THEN
CurrForm.EDITABLE(FALSE)
ELSE
IF UserSetup."Clear Credit Hold" THEN
CurrForm."Credit Hold".EDITABLE(TRUE)
ELSE
CurrForm."Credit Hold".EDITABLE(FALSE);
END ELSE
CurrForm."Credit Hold".EDITABLE(FALSE);
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by jtlanejr: Here is an example of something I did for a customer. You have to change the form in the OnOpenForm() trigger. It does require coding, so I guess I can't answer your question.
In this case twofields were added to User Setup, "Create Order" and "Clear Credit Hold". Depending on the user, certain fields will be set as not editable.
IF UserSetup.GET(USERID) THEN BEGIN
IF NOT UserSetup."Create Order" THEN
CurrForm.EDITABLE(FALSE)
ELSE
IF UserSetup."Clear Credit Hold" THEN
CurrForm."Credit Hold".EDITABLE(TRUE)
ELSE
CurrForm."Credit Hold".EDITABLE(FALSE);
END ELSE
CurrForm."Credit Hold".EDITABLE(FALSE);
Editable property of fields in a table can be set only at designtime. Controls on a form can be set Editable y/n in runtime. The control must have a name to be able to access the properties from code. Remember you have to set the editable property in each and every form where the table is used and editing could be possible. Think also of the "hidden" columns in list forms.
To allow a somewhat easier control and maintenance, it is more practical to relate the editability to a permission group than to a specific UserID. Example in pseudo code:
Permissions.setrange(User,UserID)
Permissions.setrange(Group,'Edit is Allowed')
if Permissions.find('-') then
currform."The Control".Editable := True
else
currform."The Control".Editable := False
Assigning the permission group to a user is easier than keeping track of all users individually. In fact we use this grouping method at several customers, where we have created permission groups like Sales Assistant, Accountant, Management - each containing all the permissions for all the relevant objects. A new user needs to get assigned to one permission group. To create the "overall" groups, we did develop a nifty tool that copies the permission settings from the default groups, whereby the highest permission level is retained.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by jtlanejr:
IF UserSetup.GET(USERID) THEN BEGIN
IF NOT UserSetup."Create Order" THEN
CurrForm.EDITABLE(FALSE)
ELSE
IF UserSetup."Clear Credit Hold" THEN
CurrForm."Credit Hold".EDITABLE(TRUE)
ELSE
CurrForm."Credit Hold".EDITABLE(FALSE);
END ELSE
CurrForm."Credit Hold".EDITABLE(FALSE);
<HR></BLOCKQUOTE>
Uups, what kind of coding is that?
IF UserSetup.GET(USERID) THEN
Currform.editable (UserSetup."Create Order" or UserSetup."Clear Credit Hold");
else
currform.editable(false);
IF (CONFIRM('Question 1') AND CONFIRM('Question 2')) THEN
MESSAGE('TRUE')
ELSE
MESSAGE('FALSE');
Dave,
Do you expext to see question 2 when your answer to question 1 is already FALSE ????
So the previous redisign is not advised for C/Side because there is no Left to Right evaluation....
(Navision is not equal to C)
Comments
In this case twofields were added to User Setup, "Create Order" and "Clear Credit Hold". Depending on the user, certain fields will be set as not editable.
IF UserSetup.GET(USERID) THEN BEGIN
IF NOT UserSetup."Create Order" THEN
CurrForm.EDITABLE(FALSE)
ELSE
IF UserSetup."Clear Credit Hold" THEN
CurrForm."Credit Hold".EDITABLE(TRUE)
ELSE
CurrForm."Credit Hold".EDITABLE(FALSE);
END ELSE
CurrForm."Credit Hold".EDITABLE(FALSE);
Jack
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by jtlanejr:
Here is an example of something I did for a customer. You have to change the form in the OnOpenForm() trigger. It does require coding, so I guess I can't answer your question.
In this case twofields were added to User Setup, "Create Order" and "Clear Credit Hold". Depending on the user, certain fields will be set as not editable.
IF UserSetup.GET(USERID) THEN BEGIN
IF NOT UserSetup."Create Order" THEN
CurrForm.EDITABLE(FALSE)
ELSE
IF UserSetup."Clear Credit Hold" THEN
CurrForm."Credit Hold".EDITABLE(TRUE)
ELSE
CurrForm."Credit Hold".EDITABLE(FALSE);
END ELSE
CurrForm."Credit Hold".EDITABLE(FALSE);
Jack<HR></BLOCKQUOTE>
To allow a somewhat easier control and maintenance, it is more practical to relate the editability to a permission group than to a specific UserID. Example in pseudo code:
Permissions.setrange(User,UserID)
Permissions.setrange(Group,'Edit is Allowed')
if Permissions.find('-') then
currform."The Control".Editable := True
else
currform."The Control".Editable := False
Assigning the permission group to a user is easier than keeping track of all users individually. In fact we use this grouping method at several customers, where we have created permission groups like Sales Assistant, Accountant, Management - each containing all the permissions for all the relevant objects. A new user needs to get assigned to one permission group. To create the "overall" groups, we did develop a nifty tool that copies the permission settings from the default groups, whereby the highest permission level is retained.
John
IF UserSetup.GET(USERID) THEN BEGIN
IF NOT UserSetup."Create Order" THEN
CurrForm.EDITABLE(FALSE)
ELSE
IF UserSetup."Clear Credit Hold" THEN
CurrForm."Credit Hold".EDITABLE(TRUE)
ELSE
CurrForm."Credit Hold".EDITABLE(FALSE);
END ELSE
CurrForm."Credit Hold".EDITABLE(FALSE);
<HR></BLOCKQUOTE>
Uups, what kind of coding is that?
IF UserSetup.GET(USERID) THEN
Currform.editable (UserSetup."Create Order" or UserSetup."Clear Credit Hold");
else
currform.editable(false);
... does just the same
Marcus
Marcus
Marcus Fabian
m.fabian@thenet.ch
+41 79 439 78 72
Marcus Fabian
Jack
What I wanted to point out is that the often seen construct:
If condition = True then
__boolvar := True
else
__boolvar := False;
Can be replaced with
__boolvar := condition;
Marcus
Marcus Fabian
m.fabian@thenet.ch
+41 79 439 78 72
Marcus Fabian
Currform.editable:=((UserSetup.GET(USERID))and(UserSetup."Create Order" or UserSetup."Clear Credit Hold"));
... does just the same
>>>
Uups, what kind of coding is that?
IF UserSetup.GET(USERID) THEN
Currform.editable (UserSetup."Create Order" or UserSetup."Clear Credit Hold");
else
currform.editable(false);
... does just the same
>>>
[This message has been edited by Dave Cox (edited 22-11-2000).]
Navision Service Partner
david@mindsource.co.uk
info@mindsource.co.uk
IF (CONFIRM('Question 1') AND CONFIRM('Question 2')) THEN
MESSAGE('TRUE')
ELSE
MESSAGE('FALSE');
Dave,
Do you expext to see question 2 when your answer to question 1 is already FALSE ????
So the previous redisign is not advised for C/Side because there is no Left to Right evaluation....
(Navision is not equal to C)
Keep up the good work,
Peter