You are here

README.txt in CAS roles 7.2

Same filename and directory in other branches
  1. 8 README.txt
  2. 6 README.txt
  3. 7 README.txt
==== CAS Roles ====

=== Introduction ===

This Module is supposed to be used in conjunction with cas and cas_attributes.
The general working principle is as follows:
You select a mask which contains attributes from the CAS user as a CAS role
reference. (If one of the CAS attributes is an array, the CAS role reference
is also an array. If several attributes are arrays, then the role reference is
the combination of all elements with all others.)
This role reference is then compared to the Drupal roles.
How this comparison is done can be configured.


=== Options ===

== Fetch CAS Roles ==
  * only when a CAS account is created (i.e., the first login of a CAS user).
     The roles are only set at the first login, when the user is created. The
     roles are not removed later.

  * every time a CAS user logs in.
     Every time the user logs in, the roles are updated.

== Attribute for roles ==

A CAS attribute just like in the module cas_attributes.

The CAS attribute may also be an array or even a nested array.
The field may also contain several CAS attributes in a token format. If for
example you put: "[cas-attribute-drupal_roles]-[cas-attribute-campus]" and
someone logs in with the roles "student" and "volunteer" and has as campus
attribute "main" the result would be an array containing "student-main" and
"volunteer-main".

The roles are attributed if any of the array elements match

== CAS roles mappings ==

Regular expression to map user roles. The role is assigned if one of the roles
in the attribute array matches the expression. An empty field means the role is
not administrated by CAS.

The field needs to be empty or a valid regular expression.


=== Examples ===

Your organisation has many departments and a variety of roles that are
important in other parts of your system. The client site you want to build only
needs a handful of roles but they depend on a variety of different attributes.

Lets assume for this example that one of the CAS attributes is called 'code'
and may contain a two digit country code. Another CAS attribute is called
'roles' and contains one or many roles which follow a certain pattern.
You would like to give users from a specific country special rights, while
other users may have a role 

configuration: * Fetch CAS Roles: every time a CAS user logs in. 
               * CAS vs Drupal roles: Match roles with regular expressions.
               * Attribute for roles:
      [cas:attribute:code] [cas:attribute:roles]

Now the array with be the code a space and a role per item. If more than one
attribute is an array the array used for the comparison is all possible
combinations of the different items.

If any of the items in this big array matches the regular expression for the
role, this role is assigned if none matches the role is removed.
If there is no regular expression pattern, the role will not be assigned nor
removed by cas_roles.

(side-note: if you have several complicated conditions and you are worried it
doesn't scale you may be better off implementing a module with
hook_cas_user_presave() to cater your specialised needs)

File

README.txt
View source
  1. ==== CAS Roles ====
  2. === Introduction ===
  3. This Module is supposed to be used in conjunction with cas and cas_attributes.
  4. The general working principle is as follows:
  5. You select a mask which contains attributes from the CAS user as a CAS role
  6. reference. (If one of the CAS attributes is an array, the CAS role reference
  7. is also an array. If several attributes are arrays, then the role reference is
  8. the combination of all elements with all others.)
  9. This role reference is then compared to the Drupal roles.
  10. How this comparison is done can be configured.
  11. === Options ===
  12. == Fetch CAS Roles ==
  13. * only when a CAS account is created (i.e., the first login of a CAS user).
  14. The roles are only set at the first login, when the user is created. The
  15. roles are not removed later.
  16. * every time a CAS user logs in.
  17. Every time the user logs in, the roles are updated.
  18. == Attribute for roles ==
  19. A CAS attribute just like in the module cas_attributes.
  20. The CAS attribute may also be an array or even a nested array.
  21. The field may also contain several CAS attributes in a token format. If for
  22. example you put: "[cas-attribute-drupal_roles]-[cas-attribute-campus]" and
  23. someone logs in with the roles "student" and "volunteer" and has as campus
  24. attribute "main" the result would be an array containing "student-main" and
  25. "volunteer-main".
  26. The roles are attributed if any of the array elements match
  27. == CAS roles mappings ==
  28. Regular expression to map user roles. The role is assigned if one of the roles
  29. in the attribute array matches the expression. An empty field means the role is
  30. not administrated by CAS.
  31. The field needs to be empty or a valid regular expression.
  32. === Examples ===
  33. Your organisation has many departments and a variety of roles that are
  34. important in other parts of your system. The client site you want to build only
  35. needs a handful of roles but they depend on a variety of different attributes.
  36. Lets assume for this example that one of the CAS attributes is called 'code'
  37. and may contain a two digit country code. Another CAS attribute is called
  38. 'roles' and contains one or many roles which follow a certain pattern.
  39. You would like to give users from a specific country special rights, while
  40. other users may have a role
  41. configuration: * Fetch CAS Roles: every time a CAS user logs in.
  42. * CAS vs Drupal roles: Match roles with regular expressions.
  43. * Attribute for roles:
  44. [cas:attribute:code] [cas:attribute:roles]
  45. Now the array with be the code a space and a role per item. If more than one
  46. attribute is an array the array used for the comparison is all possible
  47. combinations of the different items.
  48. If any of the items in this big array matches the regular expression for the
  49. role, this role is assigned if none matches the role is removed.
  50. If there is no regular expression pattern, the role will not be assigned nor
  51. removed by cas_roles.
  52. (side-note: if you have several complicated conditions and you are worried it
  53. doesn't scale you may be better off implementing a module with
  54. hook_cas_user_presave() to cater your specialised needs)