portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [jira] Commented: (JS1-480) Group and Role Profile Default Template Handling
Date Wed, 16 Jun 2004 01:44:10 GMT
The following comment has been added to this issue:

     Author: Bob Fleischman
    Created: Tue, 15 Jun 2004 6:43 PM
       Body:
I think I've got the new first part worked out. There are 2 parts. A new entry in JetspeedResources.properties
called services.Profiler.newgroup.template=Jetspeed; and a modification to the TurbineResource

Index: WEB-INF/conf/JetspeedResources.properties
===================================================================
RCS file: /home/cvspublic/jakarta-jetspeed/webapp/WEB-INF/conf/JetspeedResources.properties,v
retrieving revision 1.121
diff -u -r1.121 JetspeedResources.properties
--- WEB-INF/conf/JetspeedResources.properties	1 Jun 2004 22:04:24 -0000	1.121
+++ WEB-INF/conf/JetspeedResources.properties	16 Jun 2004 01:27:04 -0000
@@ -453,6 +453,9 @@
 # Setting this account to nothing configures role-based psml as the default method for new
users
 services.Profiler.newuser.template=turbine
 
+# When a new group is created, this groups's psml is cloned to the new group psml 
+services.Profiler.newgroup.template=Jetspeed
+
 # Media types template to create for user. (comma separated)
 services.Profiler.newuser.media_types=html,wml
 
Then we need to modify JetspeedProfilerService.java as follows:
Index: JetspeedProfilerService.java
===================================================================
RCS file: /home/cvspublic/jakarta-jetspeed/src/java/org/apache/jetspeed/services/profiler/JetspeedProfilerService.java,v
retrieving revision 1.56
diff -u -r1.56 JetspeedProfilerService.java
--- JetspeedProfilerService.java	23 Feb 2004 03:35:24 -0000	1.56
+++ JetspeedProfilerService.java	16 Jun 2004 01:39:01 -0000
@@ -104,6 +104,7 @@
     private final static String CONFIG_SECURITY         = "security";
     private final static String CONFIG_ROLE_FALLBACK    = "rolefallback";
     private final static String CONFIG_NEWUSER_TEMPLATE  = "newuser.template";
+	private final static String CONFIG_NEWGROUP_TEMPLATE  = "newgroup.template";
     private final static String CONFIG_NEWUSER_MEDIA     = "newuser.media_types";
     private final static String CONFIG_FALLBACK_LANGUAGE = "fallback.language";
     private final static String CONFIG_FALLBACK_COUNTRY = "fallback.country";
@@ -118,8 +119,8 @@
     private final static boolean DEFAULT_CONFIG_SECURITY = false;
     private final static boolean DEFAULT_CONFIG_ROLE_FALLBACK = true;
     private final static String DEFAULT_CONFIG_NEWUSER_TEMPLATE = null;
-    private final static String [] DEFAULT_CONFIG_NEWUSER_MEDIA =
-    { "html", "wml" };
+	private final static String DEFAULT_CONFIG_NEWGROUP_TEMPLATE = "Jetspeed";
+    private final static String [] DEFAULT_CONFIG_NEWUSER_MEDIA = { "html", "wml" };
     private final static String DEFAULT_CONFIG_ROLE_MERGE_CONTROL = "TabControl";
     private final static String DEFAULT_CONFIG_ROLE_MERGE_CONTROLLER = "TabController";
 
@@ -142,6 +143,8 @@
 
     // MODIFIED: A. Kempf
     String newUserTemplate = DEFAULT_CONFIG_NEWUSER_TEMPLATE;
+    // added by Bob Fleischman - June 2004
+	String newGroupTemplate = DEFAULT_CONFIG_NEWGROUP_TEMPLATE;
 
     boolean useSecurity = false;   // use security features
     boolean useRoleFallback = true;
@@ -165,6 +168,8 @@
     {
         Profile current = null;
         CapabilityMap map;
+        
+        String newTemplate;
 
         if (data == null)
         {
@@ -180,12 +185,24 @@
         if (newUserTemplate == null)
             return current;
 
+        // If we see a group use it, else fall back to the prrior method
+        // Remember that Roles can also have profiles so it is not enough to just check for
profile.getGroup() == null
+        // newTemplate is then passed into the createProfile call a few lines later     
      
+        if (profile.getGroup() != null) 
+        {
+        	newTemplate = newGroupTemplate;     
+        }
+        else
+        {
+        	newTemplate = newUserTemplate;
+        }
+
         if (mediaTypes != null)
         {
             Profile dummy;
             for (int ix=0; ix < mediaTypes.length; ix++)
             {
-                dummy = createProfile(data, profile, mediaTypes[ix], newUserTemplate);
+                dummy = createProfile(data, profile, mediaTypes[ix], newTemplate);
                 if (mediaTypes[ix].equalsIgnoreCase(mediaType))
                     current = dummy;
             }
@@ -818,6 +835,8 @@
         useRoleFallback = serviceConf.getBoolean( CONFIG_ROLE_FALLBACK, DEFAULT_CONFIG_ROLE_FALLBACK
);
 
         newUserTemplate = serviceConf.getString( CONFIG_NEWUSER_TEMPLATE, DEFAULT_CONFIG_NEWUSER_TEMPLATE
);
+        
+		newGroupTemplate = serviceConf.getString( CONFIG_NEWGROUP_TEMPLATE, DEFAULT_CONFIG_NEWGROUP_TEMPLATE
);
 
         useFallbackToRoot = serviceConf.getBoolean( CONFIG_FALLBACK_TO_ROOT, useFallbackToRoot
);
 
@@ -1005,8 +1024,20 @@
       if ((contentType == null) || (contentType.length() < 2))
         contentType = "html";
 
-      if ((from == null) || (from.length() < 2))
-        from = "turbine";
+		if ((from == null) || (from.length() < 2))
+		{
+//
+// This is just for groups - Roles will continue to be treated like users
+//			
+		  if (profile.getGroup() != null)
+			  from = DEFAULT_CONFIG_NEWGROUP_TEMPLATE;
+			  else
+			  from = DEFAULT_CONFIG_NEWUSER_TEMPLATE;
+		}
+
+// turbine was hardcoded here - RMF June 2004
+//      if ((from == null) || (from.length() < 2))
+//        from = "turbine";
 
 
         if ((null == profile.getDocument()) || (!profile.getMediaType().equalsIgnoreCase
(contentType)))
@@ -1018,7 +1049,11 @@
             try
             {
                 ProfileLocator locator = createLocator();
-                locator.setUser( JetspeedSecurity.getUser(from) );
+                // If group is not null assume this is a Group we are requesting
+				if (profile.getGroup() != null) 
+				  locator.setGroup( JetspeedSecurity.getGroup(from) );
+				else
+                  locator.setUser( JetspeedSecurity.getUser(from) );
 
                 locator.setMediaType(contentType);
                 PSMLDocument doc = fallback(locator);

Thanks for pointing me in the right direction. I hope this helps. I would perfer to setup
a new group called 'baseGroup' but I didn't want to start working with the Hypersonic datafiles
and the other populate statements.

---------------------------------------------------------------------
View this comment:
  http://issues.apache.org/jira/browse/JS1-480?page=comments#action_36190

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/JS1-480

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: JS1-480
    Summary: Group and Role Profile Default Template Handling
       Type: Improvement

     Status: Open
   Priority: Major

    Project: Jetspeed
 Components: 
             PSML
   Fix Fors:
             1.6-dev
   Versions:
             1.6-dev

   Assignee: David Sean Taylor
   Reporter: David Sean Taylor

    Created: Mon, 24 May 2004 9:12 AM
    Updated: Tue, 15 Jun 2004 6:43 PM

Description:
Bob Fleischman wrote:

I am familiar with services.Profiler.newuser.template for new users, but I
did not see anything similar for groups.

I would like to intercept the process and customize the Profile/PSML that is
created for each group so that I can quickly create team workspaces.

...

I noticed 2 issues that can be improved on:

1. The Turbine User (the default User template) was copied over and used as a default Group
template.
2. The Security constraint applied (owner-only) makes this PSML unaccessible

I propose 

1. enhancing the TurbineGroupManagement : adding a default Group template
2. changing the default security constraint to admin-all / owner-only for user resources,
and admin-all + particular role or group for new group or role resources
This will require creating a new role or group constraint on template creation



---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message