Seam SVN: r8409 - in trunk/doc/Seam_Reference_Guide/en-US: images and 1 other directory.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-06-24 07:19:18 -0400 (Tue, 24 Jun 2008)
New Revision: 8409
Added:
trunk/doc/Seam_Reference_Guide/en-US/images/security-permissionclass.png
trunk/doc/Seam_Reference_Guide/en-US/images/security-roleclass.png
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Security.xml
Log:
class diagrams
Modified: trunk/doc/Seam_Reference_Guide/en-US/Security.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Security.xml 2008-06-24 07:16:28 UTC (rev 8408)
+++ trunk/doc/Seam_Reference_Guide/en-US/Security.xml 2008-06-24 11:19:18 UTC (rev 8409)
@@ -2041,6 +2041,16 @@
</sect2>
+ <sect2>
+ <title>Typesafe Security Annotations</title>
+
+ <para>
+ Seam provides a number of annotations that may be used as an alternative to <literal>@Restrict</literal>, which have
+ the added advantage of providing compile-time safety as they don't support arbitrary EL expressions in the same way
+ that <literal>@Restrict</literal> does.
+ </para>
+
+ </sect2>
<sect2>
<title>Rule-based Permissions</title>
Added: trunk/doc/Seam_Reference_Guide/en-US/images/security-permissionclass.png
===================================================================
(Binary files differ)
Property changes on: trunk/doc/Seam_Reference_Guide/en-US/images/security-permissionclass.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/doc/Seam_Reference_Guide/en-US/images/security-roleclass.png
===================================================================
(Binary files differ)
Property changes on: trunk/doc/Seam_Reference_Guide/en-US/images/security-roleclass.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 5 months
Seam SVN: r8408 - branches/Seam_1_2_1_AP/src/main/org/jboss/seam/mock.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2008-06-24 03:16:28 -0400 (Tue, 24 Jun 2008)
New Revision: 8408
Modified:
branches/Seam_1_2_1_AP/src/main/org/jboss/seam/mock/MockFacesContext.java
Log:
JBPAPP-913
Modified: branches/Seam_1_2_1_AP/src/main/org/jboss/seam/mock/MockFacesContext.java
===================================================================
--- branches/Seam_1_2_1_AP/src/main/org/jboss/seam/mock/MockFacesContext.java 2008-06-24 07:13:53 UTC (rev 8407)
+++ branches/Seam_1_2_1_AP/src/main/org/jboss/seam/mock/MockFacesContext.java 2008-06-24 07:16:28 UTC (rev 8408)
@@ -1,6 +1,6 @@
/*
- * �* JBoss, Home of Professional Open Source �* �* Distributable under LGPL
- * license. �* See terms of license at gnu.org. �
+ * �* JBoss, Home of Professional Open Source �* �* Distributable under LGPL
+ * license. �* See terms of license at gnu.org. �
*/
package org.jboss.seam.mock;
@@ -194,6 +194,7 @@
@Override
public void release()
{
+ setCurrentInstance(null);
}
@Override
16 years, 5 months
Seam SVN: r8407 - branches/Seam_1_2_1_AP/examples/mail.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2008-06-24 03:13:53 -0400 (Tue, 24 Jun 2008)
New Revision: 8407
Added:
branches/Seam_1_2_1_AP/examples/mail/setup.txt
Log:
JBPAPP-802
Added: branches/Seam_1_2_1_AP/examples/mail/setup.txt
===================================================================
--- branches/Seam_1_2_1_AP/examples/mail/setup.txt (rev 0)
+++ branches/Seam_1_2_1_AP/examples/mail/setup.txt 2008-06-24 07:13:53 UTC (rev 8407)
@@ -0,0 +1,21 @@
+*************************************************
+
+This is setup description for using mail example.
+
+*************************************************
+
+This example uses third-party libraries from buni.org(meldware libs), which are primary only for JBoss AS 4.0.x.
+These libraries are needed only if you don't have got any mail server for testing receiving and sending e-mails.
+
+Libraries from meldware are deployed on JBoss AS and works as enterprise groupware inside the JBoss JEE container.
+There are some errors in starting this groupware application which are related to deploying on JBoss AS 4.2.x. These errors are registered at buni.org and in JBoss JIRA, but are not resolved,
+Referenced issues:
+http://buni.org/bugzilla/show_bug.cgi?id=162
+http://jira.jboss.com/jira/browse/JBPAPP-802
+
+We recommend to setup a mail server instead of bundled meldware server.
+Go to ./examples/mail/resource/components,xml and search for
+mail:mail-session configuration element, then e.g if you have Google email account, set up the following:
+<mail:mail-session host="smtp.google.com" port="587" username="googleuser" password="password" />.
+
+The mail example is not restricted for using any remote mail server.
\ No newline at end of file
Property changes on: branches/Seam_1_2_1_AP/examples/mail/setup.txt
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 5 months
Seam SVN: r8406 - in trunk/ui/src/main: java/org/jboss/seam/ui/component and 1 other directory.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-06-24 02:36:54 -0400 (Tue, 24 Jun 2008)
New Revision: 8406
Modified:
trunk/ui/src/main/config/component/selectItems.xml
trunk/ui/src/main/java/org/jboss/seam/ui/component/UISelectItems.java
Log:
JBSEAM-3004
Modified: trunk/ui/src/main/config/component/selectItems.xml
===================================================================
--- trunk/ui/src/main/config/component/selectItems.xml 2008-06-24 00:55:51 UTC (rev 8405)
+++ trunk/ui/src/main/config/component/selectItems.xml 2008-06-24 06:36:54 UTC (rev 8406)
@@ -55,5 +55,11 @@
<description>if true, the noSelectionLabel will be hidden when a value is selected</description>
<defaultvalue>false</defaultvalue>
</property>
+ <property>
+ <name>escape</name>
+ <classname>java.lang.Boolean</classname>
+ <description>if false, characters in the label will not be escaped. Beware that this is a safety issue when the label is in any way derived from input supplied by the application's user. . Can reference the var variable</description>
+ <defaultvalue>true</defaultvalue>
+ </property>
</component>
</components>
Modified: trunk/ui/src/main/java/org/jboss/seam/ui/component/UISelectItems.java
===================================================================
--- trunk/ui/src/main/java/org/jboss/seam/ui/component/UISelectItems.java 2008-06-24 00:55:51 UTC (rev 8405)
+++ trunk/ui/src/main/java/org/jboss/seam/ui/component/UISelectItems.java 2008-06-24 06:36:54 UTC (rev 8406)
@@ -81,13 +81,14 @@
protected abstract Object getSelectItemValue();
protected abstract String getSelectItemLabel();
protected abstract Boolean getSelectItemDisabled();
-
+ protected abstract Boolean getSelectItemEscape();
+
protected javax.faces.model.SelectItem create()
{
try
{
setup();
- return new javax.faces.model.SelectItem(this.getSelectItemValue(), this.getSelectItemLabel(), "", this.getSelectItemDisabled());
+ return new javax.faces.model.SelectItem(this.getSelectItemValue(), this.getSelectItemLabel(), "", this.getSelectItemDisabled(), this.getSelectItemEscape());
}
finally
{
@@ -138,6 +139,10 @@
public abstract void setDisabled(Boolean disabled);
+ public abstract Boolean getEscape();
+
+ public abstract void setEscape(Boolean escape);
+
public abstract Object getItemValue();
public abstract void setItemValue(Object itemValue);
@@ -198,6 +203,13 @@
}
@Override
+ protected Boolean getSelectItemEscape()
+ {
+ Boolean escape = getEscape();
+ return escape == null ? true : escape;
+ }
+
+ @Override
protected String getSelectItemLabel()
{
return emptyIfNull(getLabel());
16 years, 5 months
Seam SVN: r8405 - trunk/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-06-23 20:55:51 -0400 (Mon, 23 Jun 2008)
New Revision: 8405
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Security.xml
Log:
more detail added to authorization section
Modified: trunk/doc/Seam_Reference_Guide/en-US/Security.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Security.xml 2008-06-23 19:33:06 UTC (rev 8404)
+++ trunk/doc/Seam_Reference_Guide/en-US/Security.xml 2008-06-24 00:55:51 UTC (rev 8405)
@@ -1040,7 +1040,7 @@
<para>Property</para>
</entry>
<entry align="center">
- <para>Default</para>
+ <para>Default Value</para>
</entry>
<entry align="center">
<para>Description</para>
@@ -1408,16 +1408,59 @@
</tgroup>
</table>
</sect3>
+
+ <sect3>
+ <title>LdapIdentityStore Configuration Example</title>
+
+ <para>
+ The following configuration example shows how <literal>LdapIdentityStore</literal> may be configured for
+ an LDAP directory running on fictional host <literal>directory.mycompany.com</literal>. The users are stored
+ within this directory under the context <literal>ou=Person,dc=mycompany,dc=com</literal>, and are identified
+ using the <literal>uid</literal> attribute (which corresponds to their username). Roles are stored in their
+ own context, <literal>ou=Roles,dc=mycompany,dc=com</literal> and referenced from the user's entry via the
+ <literal>roles</literal> attribute. Role entries are identified by their common name (the <literal>cn</literal> attribute)
+ , which corresponds to the role name. In this example, users may be disabled by setting the value of their
+ <literal>enabled</literal> attribute to false.
+ </para>
+
+ <programlisting><![CDATA[
+ <security:ldap-identity-store
+ server-address="directory.mycompany.com"
+ bind-DN="cn=Manager,dc=mycompany,dc=com"
+ bind-credentials="secret"
+ user-DN-prefix="uid="
+ user-DN-suffix=",ou=Person,dc=mycompany,dc=com"
+ role-DN-prefix="cn="
+ role-DN-suffix=",ou=Roles,dc=mycompany,dc=com"
+ user-context-DN="ou=Person,dc=mycompany,dc=com"
+ role-context-DN="ou=Roles,dc=mycompany,dc=com"
+ user-role-attribute="roles"
+ role-name-attribute="cn"
+ user-object-classes="person,uidObject"
+ enabled-attribute="enabled"
+ />]]></programlisting>
+
+ </sect3>
+
</sect2>
<sect2>
- <title>Writing your own IdentityStore implementation</title>
+ <title>Writing your own IdentityStore</title>
<para>
+ Writing your own identity store implementation allows you to authenticate and perform identity management
+ operations against sources that aren't supported out of the box by Seam. Only a single class is
+ required to achieve this, and it must implement the
+ <literal>org.jboss.seam.security.management.IdentityStore</literal> interface.
+ </para>
+ <para>
+ Please refer to the JavaDoc for <literal>IdentityStore</literal> for a description of the methods that
+ must be implemented.
</para>
</sect2>
+
<sect2>
<title>Authentication with Identity Management</title>
@@ -1524,7 +1567,7 @@
There are a number of authorization features provided by the Seam Security API for securing access to
components, component methods, and pages. This section describes each of these. An important thing to
note is that if you wish to use any of the advanced features (such as rule-based permissions) then
- your <literal>components.xml</literal> must be configured to support this - see the Configuration section
+ your <literal>components.xml</literal> may need to be configured to support this - see the Configuration section
above.
</para>
@@ -1532,20 +1575,61 @@
<title>Core concepts</title>
<para>
- Each of the authorization mechanisms provided by the Seam Security API are built upon the concept of a user
- being granted roles and/or permissions. A role is a <emphasis>group</emphasis>, or <emphasis>type</emphasis>,
- of user that may have been granted certain privileges for performing one or more specific actions within an
- application. A permission on the other hand is a privilege (sometimes once-off) for performing a single,
- specific action. It is entirely possible to build an application using nothing but permissions, however
- roles offer a higher level of convenience when granting privileges to groups of users.
+ Seam Security is built around the premise of users being granted roles and/or permissions, allowing them to
+ perform operations that may not otherwise be permissible for users without the necessary security privileges.
+ Each of the authorization mechanisms provided by the Seam Security API are built upon this core concept of roles and
+ permissions, with an extensible framework providing multiple ways to secure application resources.
</para>
- <para>
- Roles are simple, consisting of only a name such as "admin", "user", "customer", etc. Permissions consist of
- both a name and an action, and are represented within this documentation in the form <literal>name:action</literal>,
- for example <literal>customer:delete</literal>, or <literal>customer:insert</literal>.
- </para>
+ <sect3>
+ <title>What is a role?</title>
+
+ <para>
+ A role is a <emphasis>group</emphasis>, or <emphasis>type</emphasis>, of user that may have been granted certain
+ privileges for performing one or more specific actions within an application. They are simple constructs, consisting
+ of just a name such as "admin", "user", "customer", etc. They can be granted either to users (or in some cases to other
+ roles), and are used to create logical groups of users for the convenient assignment of specific application privileges.
+ </para>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata fileref="images/security-roleclass.png" align="center"/>
+ </imageobject>
+ <imageobject role="html">
+ <imagedata fileref="images/security-roleclass.png" align="center"/>
+ </imageobject>
+ </mediaobject>
+ </sect3>
+
+ <sect3>
+ <title>What is a permission?</title>
+
+ <para>
+ A permission is a privilege (sometimes once-off) for performing a single, specific action. It is entirely possible to
+ build an application using nothing but permissions, however roles offer a higher level of convenience when granting
+ privileges to groups of users. They are slightly more complex in structure than roles, essentially consisting of three
+ "aspects"; a target, an action, and a recipient. The target of a permission is the object (or an arbitrary name or class)
+ for which a particular action is allowed to be performed by a specific recipient (or user). For example, the user "Bob"
+ may have permission to delete customer objects. In this case, the permission target may be "customer", the permission
+ action would be "delete" and the recipient would be "Bob".
+ </para>
+
+
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata fileref="images/security-permissionclass.png" align="center"/>
+ </imageobject>
+ <imageobject role="html">
+ <imagedata fileref="images/security-permissionclass.png" align="center"/>
+ </imageobject>
+ </mediaobject>
+
+ <para>
+ Within this documentation, permissions are represented in the form <literal>name:action</literal> (generally
+ omitting the recipient, although in reality one is always required).
+ </para>
+ </sect3>
+
</sect2>
<sect2>
@@ -1555,6 +1639,16 @@
Let's start by examining the simplest form of authorization, component security, starting with the
<literal>@Restrict</literal> annotation.
</para>
+
+ <note>
+ <title>@Restrict vs Typesafe security annotations</title>
+
+ <para>
+ While using the <literal>@Restrict</literal> annotation provides a powerful and flexible method for security component methods
+ due to its ability to support EL expressions, it is recommended that the typesafe equivalent (described later) be
+ used, at least for the compile-time safety it provides.
+ </para>
+ </note>
<sect3>
<title>The @Restrict annotation</title>
16 years, 5 months
Seam SVN: r8404 - trunk.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2008-06-23 15:33:06 -0400 (Mon, 23 Jun 2008)
New Revision: 8404
Modified:
trunk/seam21migration.txt
Log:
document DTD removal and XSD version number changes
Modified: trunk/seam21migration.txt
===================================================================
--- trunk/seam21migration.txt 2008-06-23 15:30:30 UTC (rev 8403)
+++ trunk/seam21migration.txt 2008-06-23 19:33:06 UTC (rev 8404)
@@ -15,6 +15,11 @@
each class. This is much faster. See the reference manual for how to alter the
default.
+DTDs and Schemas
+----------------
+The DTDs for Seam XML files are no longer supported. Please use the XML schemas
+for validation. Files that use the Seam 2.0 XSDs should be updated to refer to
+the 2.1 XSDs
Exception Handling
------------------
@@ -77,3 +82,4 @@
requiring that it is configured with the security rules instead of Identity:
<security:rule-based-permission-resolver security-rules="#{securityRules}"/>
+
16 years, 5 months
Seam SVN: r8403 - in branches/Seam_2_0/src/main/org/jboss/seam: core and 1 other directory.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2008-06-23 11:30:30 -0400 (Mon, 23 Jun 2008)
New Revision: 8403
Modified:
branches/Seam_2_0/src/main/org/jboss/seam/Component.java
branches/Seam_2_0/src/main/org/jboss/seam/core-2.0.xsd
branches/Seam_2_0/src/main/org/jboss/seam/core/Init.java
Log:
JBSEAM-3096
Modified: branches/Seam_2_0/src/main/org/jboss/seam/Component.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/Component.java 2008-06-23 04:18:07 UTC (rev 8402)
+++ branches/Seam_2_0/src/main/org/jboss/seam/Component.java 2008-06-23 15:30:30 UTC (rev 8403)
@@ -933,16 +933,26 @@
public void addInterceptor(Interceptor interceptor)
{
- if ( interceptor.getType()==InterceptorType.SERVER)
- {
- interceptors.add(interceptor);
- }
- else
- {
- clientSideInterceptors.add(interceptor);
- }
+ if (isInterceptorEnabled(interceptor)) {
+ if (interceptor.getType()==InterceptorType.SERVER) {
+ interceptors.add(interceptor);
+ } else {
+ clientSideInterceptors.add(interceptor);
+ }
+ }
}
+ private boolean isInterceptorEnabled(Interceptor interceptor) {
+ Class interceptorClass = interceptor.getUserInterceptorClass();
+ if (interceptorClass != null) {
+ if (Init.instance().getDisabledInterceptors().contains(interceptorClass.getName())) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
private List<Interceptor> newSort(List<Interceptor> list)
{
List<SortItem<Interceptor>> siList = new ArrayList<SortItem<Interceptor>>();
Modified: branches/Seam_2_0/src/main/org/jboss/seam/core/Init.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/core/Init.java 2008-06-23 04:18:07 UTC (rev 8402)
+++ branches/Seam_2_0/src/main/org/jboss/seam/core/Init.java 2008-06-23 15:30:30 UTC (rev 8403)
@@ -49,7 +49,9 @@
private boolean debug;
private boolean myFacesLifecycleBug;
private boolean transactionManagementEnabled = true;
-
+
+ private List<String> disabledInterceptors = new ArrayList<String>();
+
private Map<String, List<ObserverMethod>> observerMethods = new HashMap<String, List<ObserverMethod>>();
private Map<String, List<ObserverMethodExpression>> observerMethodBindings = new HashMap<String, List<ObserverMethodExpression>>();
private Map<String, FactoryMethod> factories = new HashMap<String, FactoryMethod>();
@@ -521,4 +523,12 @@
{
return globalImports;
}
+
+ public List<String> getDisabledInterceptors() {
+ return disabledInterceptors;
+ }
+
+ public void setDisabledInterceptors(List<String> disabledInterceptors) {
+ this.disabledInterceptors = disabledInterceptors;
+ }
}
Modified: branches/Seam_2_0/src/main/org/jboss/seam/core-2.0.xsd
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/core-2.0.xsd 2008-06-23 04:18:07 UTC (rev 8402)
+++ branches/Seam_2_0/src/main/org/jboss/seam/core-2.0.xsd 2008-06-23 15:30:30 UTC (rev 8403)
@@ -6,6 +6,10 @@
<xs:element name="init">
<xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="disabled-interceptors" type="components:multiValuedProperty" />
+ </xs:choice>
+
<xs:attributeGroup ref="components:attlist.component"/>
<xs:attributeGroup ref="core:attlist.init"/>
</xs:complexType>
@@ -29,6 +33,7 @@
</xs:simpleType>
</xs:attribute>
<xs:attribute name="user-transaction-name"/>
+ <xs:attribute name="disabled-interceptors" type="components:string" />
</xs:attributeGroup>
<xs:element name="manager">
16 years, 5 months
Seam SVN: r8402 - trunk/doc/Seam_Reference_Guide/en-US/images.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-06-23 00:18:07 -0400 (Mon, 23 Jun 2008)
New Revision: 8402
Added:
trunk/doc/Seam_Reference_Guide/en-US/images/security-entities-1.png
trunk/doc/Seam_Reference_Guide/en-US/images/security-entities-2.png
Log:
diagrams
Added: trunk/doc/Seam_Reference_Guide/en-US/images/security-entities-1.png
===================================================================
(Binary files differ)
Property changes on: trunk/doc/Seam_Reference_Guide/en-US/images/security-entities-1.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/doc/Seam_Reference_Guide/en-US/images/security-entities-2.png
===================================================================
(Binary files differ)
Property changes on: trunk/doc/Seam_Reference_Guide/en-US/images/security-entities-2.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 5 months
Seam SVN: r8401 - trunk/src/main/org/jboss/seam/security/management.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-06-22 23:53:19 -0400 (Sun, 22 Jun 2008)
New Revision: 8401
Modified:
trunk/src/main/org/jboss/seam/security/management/IdentityStore.java
Log:
javadoc
Modified: trunk/src/main/org/jboss/seam/security/management/IdentityStore.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/management/IdentityStore.java 2008-06-22 09:19:16 UTC (rev 8400)
+++ trunk/src/main/org/jboss/seam/security/management/IdentityStore.java 2008-06-23 03:53:19 UTC (rev 8401)
@@ -15,6 +15,9 @@
public enum Feature { createUser, deleteUser, enableUser, disableUser, changePassword,
createRole, deleteRole, grantRole, revokeRole }
+ /**
+ * Represents a set of optional features that an IdentityStore implementation might support.
+ */
public class FeatureSet
{
private Set<Feature> features;
@@ -61,33 +64,151 @@
for (Feature f : Feature.values()) addFeature(f);
}
}
-
+
+ /**
+ * Returns true if the IdentityStore implementation supports the specified feature.
+ *
+ */
boolean supportsFeature(Feature feature);
+
+ /**
+ * Creates a new user with the specified username and password.
+ * @return true if the user was successfully created.
+ */
+ boolean createUser(String username, String password);
- boolean createUser(String username, String password);
+ /**
+ * Creates a new user with the specified username, password, first name and last name.
+ *
+ * @return true if the user was successfully created.
+ */
boolean createUser(String username, String password, String firstname, String lastname);
+
+ /**
+ * Deletes the user with the specified username.
+ * @return true if the user was successfully deleted.
+ */
boolean deleteUser(String name);
+
+ /**
+ * Enables the user with the specified username. Enabled users are able to authenticate.
+ * @return true if the specified user was successfully enabled.
+ */
boolean enableUser(String name);
+
+ /**
+ * Disables the user with the specified username. Disabled users are unable to authenticate.
+ * @return true if the specified user was successfully disabled.
+ */
boolean disableUser(String name);
+
+ /**
+ * Returns true if the specified user is enabled.
+ */
boolean isUserEnabled(String name);
+
+ /**
+ * Changes the password of the specified user to the specified password.
+ * @return true if the user's password was successfully changed.
+ */
boolean changePassword(String name, String password);
+
+ /**
+ * Returns true if the specified user exists.
+ */
boolean userExists(String name);
+
+ /**
+ * Creates a new role with the specified role name.
+ * @return true if the role was created successfully.
+ */
+ boolean createRole(String role);
- boolean createRole(String role);
+ /**
+ * Grants the specified role to the specified user.
+ *
+ * @param name The name of the user
+ * @param role The name of the role to grant to the user.
+ * @return true if the role was successfully granted.
+ */
boolean grantRole(String name, String role);
+
+ /**
+ * Revokes the specified role from the specified user.
+ *
+ * @param name The name of the user
+ * @param role The name of the role to grant to the user.
+ * @return true if the role was successfully revoked.
+ */
boolean revokeRole(String name, String role);
+
+ /**
+ * Deletes the specified role.
+ * @return true if the role was successfully deleted.
+ */
boolean deleteRole(String role);
- boolean roleExists(String name);
+
+ /**
+ * Returns true if the specified role exists.
+ */
+ boolean roleExists(String name);
+
+ /**
+ * Adds the specified role as a member of the specified group.
+ *
+ * @param role The name of the role to add as a member
+ * @param group The name of the group that the specified role will be added to.
+ * @return true if the role was successfully added to the group.
+ */
boolean addRoleToGroup(String role, String group);
+
+ /**
+ * Removes the specified role from the specified group.
+ *
+ * @param role The name of the role to remove from the group.
+ * @param group The group from which to remove the role.
+ * @return true if the role was successfully removed from the group.
+ */
boolean removeRoleFromGroup(String role, String group);
+ /**
+ * Returns a list of all users.
+ */
List<String> listUsers();
+
+ /**
+ * Returns a list of all users containing the specified filter text within their username.
+
+ */
List<String> listUsers(String filter);
+
+ /**
+ * Returns a list of all the roles.
+ */
List<String> listRoles();
+
+ /**
+ * Returns a list of all the roles explicitly granted to the specified user.
+ */
+ List<String> getGrantedRoles(String name);
- List<String> getGrantedRoles(String name);
+ /**
+ * Returns a list of all roles that the specified user is a member of. This list may contain
+ * roles that may not have been explicitly granted to the user, which are indirectly implied
+ * due to group memberships.
+
+ */
List<String> getImpliedRoles(String name);
+
+ /**
+ * Returns a list of all the groups that the specified role is a member of.
+ */
List<String> getRoleGroups(String name);
-
+
+ /**
+ * Authenticates the specified user, using the specified password.
+ *
+ * @return true if authentication is successful.
+ */
boolean authenticate(String username, String password);
}
16 years, 5 months
Seam SVN: r8400 - in trunk/examples/wiki/src/main/org/jboss/seam/wiki/core: model and 1 other directory.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2008-06-22 05:19:16 -0400 (Sun, 22 Jun 2008)
New Revision: 8400
Modified:
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/UserProfile.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiTextMacro.java
Log:
Don't sync profile on registration, avoid NPE
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java 2008-06-20 18:44:11 UTC (rev 8399)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java 2008-06-22 09:19:16 UTC (rev 8400)
@@ -166,8 +166,7 @@
public String persist() {
// Validate
- if (!validateWikiTextEditors() ||
- !isUniqueUsername() ||
+ if (!isUniqueUsername() ||
!passwordAndControlNotNull() ||
!passwordMatchesRegex() ||
!passwordMatchesControl()) {
@@ -179,8 +178,6 @@
return null;
}
- syncWikiTextEditorsToInstance();
-
// Assign default role
getInstance().getRoles().add(defaultRole);
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/UserProfile.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/UserProfile.java 2008-06-20 18:44:11 UTC (rev 8399)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/UserProfile.java 2008-06-22 09:19:16 UTC (rev 8400)
@@ -73,7 +73,7 @@
}
public void setBio(String bio) {
- this.bio = bio.length() > 0 ? bio : null;
+ this.bio = bio != null && bio.length() > 0 ? bio : null;
}
public String getWebsite() {
@@ -81,7 +81,7 @@
}
public void setWebsite(String website) {
- this.website = website.length() > 0 ? website : null;
+ this.website = website != null && website.length() > 0 ? website : null;
}
public String getLocation() {
@@ -89,7 +89,7 @@
}
public void setLocation(String location) {
- this.location = location.length() > 0 ? location : null;
+ this.location = location != null && location.length() > 0 ? location : null;
}
public String getOccupation() {
@@ -97,7 +97,7 @@
}
public void setOccupation(String occupation) {
- this.occupation = occupation.length() > 0 ? occupation : null;
+ this.occupation = occupation != null && occupation.length() > 0 ? occupation : null;
}
public String getSignature() {
@@ -105,7 +105,7 @@
}
public void setSignature(String signature) {
- this.signature = signature.length() > 0 ? signature : null;
+ this.signature = signature != null && signature.length() > 0 ? signature : null;
}
public byte[] getImage() {
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiTextMacro.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiTextMacro.java 2008-06-20 18:44:11 UTC (rev 8399)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiTextMacro.java 2008-06-22 09:19:16 UTC (rev 8400)
@@ -8,6 +8,7 @@
import java.util.TreeMap;
import java.util.SortedMap;
+import java.util.Map;
import java.io.Serializable;
/**
@@ -70,6 +71,13 @@
this.params = params;
}
+ public String getParamValue(String paramName) {
+ for (Map.Entry<String, String> param : params.entrySet()) {
+ if (param.getKey().equals(paramName)) return param.getValue();
+ }
+ return null;
+ }
+
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
16 years, 5 months