Table of Contents
The following XML will be used to provide some explanation on the context security configuration
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE contextconfig PUBLIC "//MMBase - contextconfig//" "http://www.mmbase.org/dtd/securitycontextconfig.dtd"> <contextconfig> <loginmodules> <module name="anonymous" class="org.mmbase.security.implementation.context.AnonymousLogin" /> <module name="name/password" class="org.mmbase.security.implementation.context.PasswordLogin" /> </loginmodules> <accounts> <user name="anonymous" context="default" /> <user name="admin" context="admin"> <identify type="name/password" rank="administrator">admin2k</identify> </user> <user name="foo" context="default" > <identify type="name/password" rank="basic user">bar</identify> </user> </accounts> <groups> <group name="everyone"> <contains type="group" named="users" /> <contains type="user" named="anonymous" /> </group> <group name="users"> <contains type="user" named="foo" /> <contains type="group" named="administrators" /> </group> <group name="administrators"> <contains type="user" named="admin" /> </group> </groups> <contexts default="default"> <context name="default"> <operation type="create"> <grant group="users" /> </operation> <operation type="read"> <grant group="everyone" /> </operation> <operation type="write"> <grant group="users" /> </operation> <operation type="link"> <grant group="users" /> </operation> <operation type="delete"> <grant group="users" /> </operation> <operation type="change context"> <grant group="administrators" /> </operation> <possible context="default" /> </context> </contexts> </contextconfig>
This defines groups within the context security. The following structure applies:
<group name="%name%"> <contains type="user" named="%username%" /> <contains type="user" named="%username%" /> <contains type="group" named="%groupname%" /> <contains type="group" named="%groupname%" /> </group>
The following values can be given to the elements of contexts.
<contexts> ... </contexts> : This is a list of contexts that can be used within the context system.
<context name="%contextname%"> <operation type="%operation%" /> <operation type="%operation%"> <grant group="%groupname%" /> <grant group="%groupname%" /> </operation> <possible context="%contextname%" /> <possible context="%contextname%" /> </context>
The following values can be given to the elements:
For completeness this is the full DTD used for context.xml:
<!ELEMENT contextconfig ( loginmodules, accounts, groups, contexts ) > <!ELEMENT loginmodules ( module+ ) > <!ELEMENT module ( property* ) > <!ATTLIST module class NMTOKEN #REQUIRED > <!ATTLIST module name CDATA #REQUIRED > <!ELEMENT property ( #PCDATA ) > <!ATTLIST property name NMTOKEN #REQUIRED > <!ELEMENT accounts ( user+ ) > <!ELEMENT user ( identify* ) > <!ATTLIST user context NMTOKEN #REQUIRED > <!ATTLIST user name NMTOKEN #REQUIRED > <!ELEMENT identify ( #PCDATA ) > <!ATTLIST identify rank (administrator | basic user) #REQUIRED > <!ATTLIST identify type CDATA #REQUIRED > <!ELEMENT groups ( group+ ) > <!ELEMENT group ( contains+ ) > <!ATTLIST group name NMTOKEN #REQUIRED > <!ELEMENT contains EMPTY > <!ATTLIST contains named NMTOKEN #REQUIRED > <!ATTLIST contains type NMTOKEN #REQUIRED > <!ELEMENT contexts ( context+ ) > <!ATTLIST contexts default NMTOKEN #REQUIRED > <!ELEMENT context ( operation*, possible* ) > <!ATTLIST context name NMTOKEN #REQUIRED > <!ELEMENT operation ( grant* ) > <!ATTLIST operation type (read | write | link | delete | change context) #REQUIRED > <!ELEMENT grant EMPTY > <!ATTLIST grant group NMTOKEN #REQUIRED > <!ELEMENT possible EMPTY > <!ATTLIST possible context NMTOKEN #REQUIRED >
This is part of the MMBase documentation.
For questions and remarks about this documentation mail to: documentation@mmbase.org