This topic is locked

Changing field format based on access level

12/2/2008 4:40:19 PM
ASPRunnerPro General questions
D
dsk author

If SESSION("AccessLevel")=ACCESS_LEVEL_ADMINGROUP then I would like ApplicationComplete field to be editable otherwise, I want it to be readonly on the ADD Page
Could you help me with code to accomplish this? I am running ASPRunnerPro 5.2 (Build 414)

J
Jane 12/3/2008

Hi,
use Add page: Before display event for this purpose. Here is a sample:

If SESSION("AccessLevel")=ACCESS_LEVEL_ADMINGROUP then

xt.assign "FieldName_fieldblock",True

else

xt.assign "FieldName_fieldblock",False

end if

D
dsk author 12/3/2008

Thank you Jane,
I tried the code, however I am now receiving the following:

Technical information

Error number 424

Error description Object required

URL /

Solution Please contact support team and send detailed description of what you doing or your event code.
Any other suggestions?

J
Jane 12/3/2008

What ASPRunnerPro version do you use?

D
dsk author 12/3/2008

I am running ASPRunnerPro 5.2 (build 414)

J
Jane 12/4/2008

Hi,
please check this thread:

http://www.asprunner.com/forums/index.php?showtopic=6201
Also contact support@xlinesoft.com for latest build (423) of ASPRunnerPro 5.2.

D
dsk author 12/4/2008

Thank you Jane,
I did check the thread you mentioned prior to my post. The example is to "Hide" the data for certain users, which is not my intent. I merely would like to "show as readonly" for users, but have the field editable for the AdminGroup. I could not modify that code to accomplish this. (I'm sorry, but I am not a programmer, although I do my best)
I will contact support@xlinesoft.com for the newest build as well as the status of my email regarding this issue.
Thank you again.

J
Jane 12/5/2008

answered in your personal email.

A
akira_nagasaki 1/22/2009

answered in your personal email.


may i know the answers as well?

D
dsk author 4/3/2009

The resolution is a two step process.

Access HTML code on the Visual Editor Tab:

Find this code:

<TR>

<TD class=shade width=150>FieldName</TD> <TD> width=250> {build_edit_control field="FieldName" value=$value_FieldName mode="edit"} </TD></TR>
Replace with:

<TR>

<TD class=shade width=150>FieldName</TD> <TD> width=250>{if $admin_user} {build_edit_control field="FieldName" value=$value_FieldName mode="edit"} {else} {$value_FieldName} {/if} </TD></TR>
Then add "Before display" event ont he events tab and use following code:

smarty.Add "admin_user", SESSION("AccessLevel")=ACCESS_LEVEL_ADMINGROUP
Thank you Jane for all of your assistance. I apologize to the rest of you for not posting this response sooner.

M
manan 4/22/2009

Great! What about ASPRunnerPro 6.0? Same intention - only Admin users can edit, other users can readonly.
A solution that looks like sonething that Jane has given us before; that is:
If SESSION("AccessLevel")=ACCESS_LEVEL_ADMINGROUP then

xt.assign "FieldName_fieldblock",True

else

xt.assign "FieldName_fieldblock",False

end if
Instead of "fieldblock", to change the setting for "edit".
Pls help. Thanks!

J
Jane 4/23/2009

Hi,
you can set up permissions for admin and for users on the Security tab directly.

M
manan 4/23/2009

Hi,

you can set up permissions for admin and for users on the Security tab directly.


Yes, I can do that. But what about applying readonly access rights to certain fields for all users except the Admin users who have full access rights.
For example, at the Edit page, I do not want users to modify a few fields called "Name of Staff", "Date of Birth", etc. eventhough it is their own data/entry. Only Admin can change the data once the users have submitted them. At the same page, the users can still edit/modify other fields such as "Telephone Number", "Address", etc.
In other words, how do you control individual fields in ASPRunnerPro ver 6.0, so that they can be readonly/editable by usergroups.
Please advise.
Thank you.

J
Jane 4/27/2009

Hi,
you can create custom view on the Datasourse tables tab for users and set up Name of Staff, Date of Birth fields as readonly on the Visual Editor tab.

Then set up permissions for this view for users only on the Security tab.