Jump to content

Recommended Posts

I'm wondering myself too.

I know you can get the current_user_id in spell, but I don't know how to get the current role for that user. Since there are multiple roles possible for a user, there needs to be a way to get it from the session object, but i haven't found it so far...

Keep us posted on your progress!

Share this post


Link to post
Share on other sites
I think the role is purely a web variable. That means you're not going to get it in spel.

Oh yes you can, and here's how:

As stated before you can get the current role from ahdtop.

Now for the object that's triggering your spel code, do the following:

1. Create a local attribute in your mod file

2. Create a hidden field referring to the local attribute in the detail_xx.htmpl

3. Assign the hidden fied the value off the current role.

Now you can use this value as any other attribute.

Share this post


Link to post
Share on other sites
Oh yes you can, and here's how:

As stated before you can get the current role from ahdtop.

Now for the object that's triggering your spel code, do the following:

1. Create a local attribute in your mod file

2. Create a hidden field referring to the local attribute in the detail_xx.htmpl

3. Assign the hidden fied the value off the current role.

Now you can use this value as any other attribute.

Can you post an example of what you mean?

Share this post


Link to post
Share on other sites
Can you post an example of what you mean?

for check if exists administration role in current user roles :

string someuser;

send_wait(0, top_object(), "call_attr", "cnt", "current_user_id");

someuser = msg[0];

string where_clause;

where_clause = format("contact = U'%s' and role_obj = %s", someuser, "10002");

send_wait(0, top_object(), "call_attr", "cnt_role", "sync_fetch", "RLIST_STATIC",where_clause, -1, 0);

string IsAdmin;

IsAdmin = msg[1];

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...