Hi,

I have several domains. Depending on the current domain, I like to assign an additional role to the current user (not to unauthenticated user). As far as I can see there is no module for that. So I guess I will have to write one on my own. Still, I'm struggling a little bit where to begin. For example, is the main domain module providing a hook, which I can implement so that I can add a role to the current user before the page is rendered? Which module is doing something similar so that I can take a look at the code?

Comments

agentrickard’s picture

Dynamic privilege esclation is a Very Bad Idea from a security perspective. You would want to poke Drupal core (likely hook_user or similar) to see where role assignments are done.

DA never touches this information. Just read the $_domain global and act accordingly, if you feel you must.

You can also, theoretically, use Domain Prefix to prefix the {users_roles} and {permissions} tables, and then set roles and permissions per-domain.

advseb’s picture

Security might be a concern, but not in my case. Users from a subdomain should just be not able to use fckeditor, so users of the main site get assigned an additional role with permissions set to use fckeditor. I thought that this is a very common use case, because in drupal you often control the availability of certain features through permissions.

agentrickard’s picture

I would be tempted to manipulate the fckeditor settings (likely in the $conf array) rather than the user permissions.

advseb’s picture

Status: Active » Closed (fixed)