[kune-commits] r872 - in trunk: . img/nav-icons src/main/java/org/ourproject/kune/chat/client src/main/java/org/ourproject/kune/docs/client src/main/java/org/ourproject/kune/docs/client/cnt src/main/java/org/ourproject/kune/docs/client/ctx/admin src/main/java/org/ourproject/kune/platf/client/dto src/main/java/org/ourproject/kune/platf/client/rpc src/main/java/org/ourproject/kune/platf/client/services src/main/java/org/ourproject/kune/platf/client/state src/main/java/org/ourproject/kune/platf/client/ui/dialogs src/main/java/org/ourproject/kune/platf/client/ui/rate src/main/java/org/ourproject/kune/platf/public/images/nav src/main/java/org/ourproject/kune/platf/server src/main/java/org/ourproject/kune/platf/server/access src/main/java/org/ourproject/kune/platf/server/auth src/main/java/org/ourproject/kune/platf/server/manager src/main/java/org/ourproject/kune/platf/server/manager/impl src/main/java/org/ourproject/kune/platf/server/rpc src/main/java/org/ourproject/kune/platf/server/state src/main/java/org/ourproject/kune/workspace/client/ctxnav src/main/java/org/ourproject/kune/workspace/client/socialnet src/main/java/org/ourproject/kune/workspace/client/themes src/main/java/org/ourproject/kune/workspace/client/title src/test/java/org/ourproject/kune/platf/integration/content src/test/java/org/ourproject/kune/platf/integration/socialnet src/test/java/org/ourproject/kune/platf/server/auth

vjrj vjrj at ourproject.org
Thu Sep 18 02:46:37 CEST 2008


Author: vjrj
Date: 2008-09-18 02:45:41 +0200 (Thu, 18 Sep 2008)
New Revision: 872

Added:
   trunk/img/nav-icons/gallery_add.png
   trunk/img/nav-icons/room.png
   trunk/img/nav-icons/room_add.png
   trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/gallery_add.png
   trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/room.png
   trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/room_add.png
   trunk/src/main/java/org/ourproject/kune/platf/server/auth/ActionLevel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorToolbar.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/EntityToolbar.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/EntityToolbarView.java
Removed:
   trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessType.java
   trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizated.java
   trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizatedMethodInterceptor.java
   trunk/src/main/java/org/ourproject/kune/platf/server/auth/GroupAuthorizated.java
   trunk/src/main/java/org/ourproject/kune/platf/server/auth/GroupAuthorizatedMethodInterceptor.java
Modified:
   trunk/img/nav-icons/upload.png
   trunk/pom.xml
   trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java
   trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java
   trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java
   trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextPresenter.java
   trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java
   trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentService.java
   trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentServiceAsync.java
   trunk/src/main/java/org/ourproject/kune/platf/client/rpc/GroupService.java
   trunk/src/main/java/org/ourproject/kune/platf/client/rpc/GroupServiceAsync.java
   trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkService.java
   trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkServiceAsync.java
   trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
   trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderDefault.java
   trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/FileUploaderDialog.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPresenter.java
   trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/upload.gif
   trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/upload.png
   trunk/src/main/java/org/ourproject/kune/platf/server/PlatformServerModule.java
   trunk/src/main/java/org/ourproject/kune/platf/server/access/Access.java
   trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessService.java
   trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessServiceDefault.java
   trunk/src/main/java/org/ourproject/kune/platf/server/auth/Authorizated.java
   trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptor.java
   trunk/src/main/java/org/ourproject/kune/platf/server/manager/GroupManager.java
   trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java
   trunk/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java
   trunk/src/main/java/org/ourproject/kune/platf/server/rpc/GroupRPC.java
   trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java
   trunk/src/main/java/org/ourproject/kune/platf/server/state/StateServiceDefault.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigator.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorView.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/themes/WsThemePresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePresenter.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentCommentServiceTest.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceAddTest.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceGetTest.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceIntegrationTest.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceSaveTest.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/socialnet/SocialNetworkServiceTest.java
   trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptorTest.java
   trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptorTest.java
Log:
Complete - task 38: Auth*MethodInterceptors Tests and refactorization (now userhash + StateToken are checked with annotations in services) 

Incomplete - task 45: setContext/Content 

Incomplete - task 54: ContextNav refactorization (less bussiness logic in view) and tests

Added: trunk/img/nav-icons/gallery_add.png
===================================================================
(Binary files differ)


Property changes on: trunk/img/nav-icons/gallery_add.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/img/nav-icons/room.png
===================================================================
(Binary files differ)


Property changes on: trunk/img/nav-icons/room.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/img/nav-icons/room_add.png
===================================================================
(Binary files differ)


Property changes on: trunk/img/nav-icons/room_add.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/img/nav-icons/upload.png
===================================================================
(Binary files differ)

Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/pom.xml	2008-09-18 00:45:41 UTC (rev 872)
@@ -326,7 +326,7 @@
       <plugin>
         <groupId>com.totsp.gwt</groupId>
         <artifactId>maven-googlewebtoolkit2-plugin</artifactId>
-        <version>2.0-beta14</version>
+        <version>2.0-beta23</version>
         <configuration>
           <logLevel>INFO</logLevel>
           <style>PRETTY</style>

Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -76,8 +76,14 @@
 	};
 	final String initialWindowTitle = Window.getTitle();
 	chatOptions.userOptions = userChatOptions;
-	emiteDialog.start(userChatOptions, chatOptions.httpBase, chatOptions.roomHost, initialWindowTitle,
-		avatarProvider, i18n.t("Chat"));
+	if (emiteDialog.isDialogNotStarted()) {
+	    emiteDialog.start(userChatOptions, chatOptions.httpBase, chatOptions.roomHost, initialWindowTitle,
+		    avatarProvider, i18n.t("Chat"));
+	} else {
+	    emiteDialog.setEnableStatusUI(true);
+	    emiteDialog.refreshUserInfo(chatOptions.userOptions);
+
+	}
 	emiteDialog.show(OwnStatus.online);
 	if (traybarButton == null) {
 	    traybarButton = new ToolbarButton();
@@ -106,7 +112,6 @@
 		}
 	    });
 	}
-	emiteDialog.setEnableStatusUI(true);
 	emiteDialog.hide();
 	emiteDialog.onChatAttended(new Slot<String>() {
 	    public void onEvent(final String parameter) {

Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -28,6 +28,7 @@
 import org.ourproject.kune.platf.client.actions.ActionMenuDescriptor;
 import org.ourproject.kune.platf.client.actions.ActionPosition;
 import org.ourproject.kune.platf.client.dto.AccessRolDTO;
+import org.ourproject.kune.platf.client.dto.ContentDTO;
 import org.ourproject.kune.platf.client.dto.InitDataDTO;
 import org.ourproject.kune.platf.client.dto.StateDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
@@ -44,6 +45,7 @@
 import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
 import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
 
+import com.allen_sauer.gwt.log.client.Log;
 import com.calclab.suco.client.provider.Provider;
 import com.calclab.suco.client.signal.Slot;
 
@@ -102,23 +104,21 @@
     private void createActions() {
 	final ActionMenuDescriptor<StateToken> addFolder = createFolderAction(TYPE_FOLDER, "images/nav/folder_add.png",
 		i18n.t("New folder"), i18n.t("File"), i18n.t("New"));
-	final ActionMenuDescriptor<StateToken> addGallery = createFolderAction(TYPE_GALLERY, "images/nav/gallery.png",
-		i18n.t("New gallery"), i18n.t("File"), i18n.t("New"));
+	final ActionMenuDescriptor<StateToken> addGallery = createFolderAction(TYPE_GALLERY,
+		"images/nav/gallery_add.png", i18n.t("New gallery"), i18n.t("File"), i18n.t("New"));
 
 	final ActionMenuDescriptor<StateToken> addDoc = new ActionMenuDescriptor<StateToken>(AccessRolDTO.Editor,
 		ActionPosition.topbarAndItemMenu, new Slot<StateToken>() {
 		    public void onEvent(final StateToken token) {
+			Site.showProgressProcessing();
 			contentServiceProvider.get().addContent(session.getUserHash(),
-				session.getCurrentState().getGroup().getShortName(),
-				session.getCurrentState().getContainer().getId(), i18n.t("New document"),
+				session.getCurrentState().getStateToken(), i18n.t("New document"),
 				new AsyncCallbackSimple<StateDTO>() {
 				    public void onSuccess(final StateDTO state) {
-					contextNavigator.setState(state);
+					contextNavigator.setEditOnNextStateChange(true);
 					stateManager.setRetrievedState(state);
-					contextNavigator.editItem(state.getStateToken());
 				    }
 				});
-
 		    }
 		});
 	addDoc.setTextDescription(i18n.t("New document"));
@@ -141,8 +141,7 @@
 	final ActionMenuDescriptor<StateToken> delContent = new ActionMenuDescriptor<StateToken>(
 		AccessRolDTO.Administrator, ActionPosition.topbarAndItemMenu, new Slot<StateToken>() {
 		    public void onEvent(final StateToken token) {
-			contentServiceProvider.get().delContent(session.getUserHash(),
-				session.getCurrentState().getGroup().getShortName(), token.getDocument(),
+			contentServiceProvider.get().delContent(session.getUserHash(), token,
 				new AsyncCallbackSimple<String>() {
 				    public void onSuccess(final String result) {
 					final StateToken parent = token.clone().clearDocument();
@@ -165,6 +164,11 @@
 		});
 	go.setTextDescription(i18n.t("Open"));
 	go.setIconUrl("images/nav/go.png");
+	go.setEnableCondition(new ActionEnableCondition<StateToken>() {
+	    public boolean mustBeEnabled(final StateToken currentStateToken) {
+		return !contextNavigator.isSelected(currentStateToken);
+	    }
+	});
 
 	final ActionDescriptor<StateToken> rename = new ActionDescriptor<StateToken>(AccessRolDTO.Editor,
 		ActionPosition.itemMenu, new Slot<StateToken>() {
@@ -181,22 +185,37 @@
 		    }
 		});
 	goGroupHome.setIconUrl("images/group-home.png");
-	goGroupHome.setLeftSeparator(ActionButtonSeparator.fill);
-	goGroupHome.setRightSeparator(ActionButtonSeparator.separator);
 	goGroupHome.setEnableCondition(new ActionEnableCondition<StateToken>() {
-	    public boolean mustBeEnabled(final StateToken param) {
-		return !param.equals(session.getCurrentState().getStateToken());
+	    public boolean mustBeEnabled(final StateToken currentStateToken) {
+		final StateToken defContentToken = session.getCurrentState().getGroup().getDefaultContent()
+			.getStateToken();
+		return !currentStateToken.equals(defContentToken);
 	    }
 	});
 
 	final ActionMenuDescriptor<StateToken> setAsDefGroupContent = new ActionMenuDescriptor<StateToken>(
 		AccessRolDTO.Administrator, ActionPosition.itemMenu, new Slot<StateToken>() {
 		    public void onEvent(final StateToken token) {
-			Site.info("In development");
+			Site.showProgressProcessing();
+			contentServiceProvider.get().setAsDefaultContent(session.getUserHash(), token,
+				new AsyncCallbackSimple<ContentDTO>() {
+				    public void onSuccess(ContentDTO defContent) {
+					session.getCurrentState().getGroup().setDefaultContent(defContent);
+					Site.hideProgress();
+					Site.info(i18n.t("Document selected as the group homepage"));
+				    }
+				});
 		    }
 		});
 	setAsDefGroupContent.setTextDescription(i18n.t("Set this as the group default page"));
 	setAsDefGroupContent.setIconUrl("images/group-home.png");
+	setAsDefGroupContent.setEnableCondition(new ActionEnableCondition<StateToken>() {
+	    public boolean mustBeEnabled(final StateToken currentStateToken) {
+		final StateToken defContentToken = session.getCurrentState().getGroup().getDefaultContent()
+			.getStateToken();
+		return !contextNavigator.isSelected(defContentToken);
+	    }
+	});
 
 	final ActionButtonDescriptor<StateToken> refresh = new ActionButtonDescriptor<StateToken>(AccessRolDTO.Viewer,
 		ActionPosition.topbar, new Slot<StateToken>() {
@@ -207,6 +226,7 @@
 		});
 	refresh.setIconUrl("images/nav/refresh.png");
 	refresh.setToolTip(i18n.t("Refresh"));
+	refresh.setLeftSeparator(ActionButtonSeparator.fill);
 
 	final ActionDescriptor<StateToken> uploadFile = createUploadAction(i18n.t("Upload file"),
 		"images/nav/upload.png", i18n.t("Upload some files (images, PDFs, ...)"), null);
@@ -220,7 +240,7 @@
 	    }
 	});
 
-	// contextNavigator.addAction(TYPE_FOLDER, go);
+	contextNavigator.addAction(TYPE_FOLDER, go);
 	contextNavigator.addAction(TYPE_FOLDER, addDoc);
 	contextNavigator.addAction(TYPE_FOLDER, addFolder);
 	contextNavigator.addAction(TYPE_FOLDER, delContainer);
@@ -229,10 +249,14 @@
 	contextNavigator.addAction(TYPE_FOLDER, refresh);
 	contextNavigator.addAction(TYPE_FOLDER, uploadFile);
 
+	contextNavigator.addAction(TYPE_BLOG, go);
 	contextNavigator.addAction(TYPE_BLOG, uploadFile);
 	contextNavigator.addAction(TYPE_BLOG, setAsDefGroupContent);
+	contextNavigator.addAction(TYPE_BLOG, refresh);
 
+	contextNavigator.addAction(TYPE_GALLERY, go);
 	contextNavigator.addAction(TYPE_GALLERY, goGroupHome);
+	contextNavigator.addAction(TYPE_GALLERY, refresh);
 
 	contextNavigator.addAction(TYPE_ROOT, addDoc);
 	contextNavigator.addAction(TYPE_ROOT, addFolder);
@@ -241,7 +265,7 @@
 	contextNavigator.addAction(TYPE_ROOT, refresh);
 	contextNavigator.addAction(TYPE_ROOT, uploadFile);
 
-	// contextNavigator.addAction(TYPE_DOCUMENT, go);
+	contextNavigator.addAction(TYPE_DOCUMENT, go);
 	contextNavigator.addAction(TYPE_DOCUMENT, delContent);
 	contextNavigator.addAction(TYPE_DOCUMENT, rename);
 	contextNavigator.addAction(TYPE_DOCUMENT, goGroupHome);
@@ -254,14 +278,14 @@
 	final ActionMenuDescriptor<StateToken> addFolder;
 	addFolder = new ActionMenuDescriptor<StateToken>(AccessRolDTO.Editor, ActionPosition.topbarAndItemMenu,
 		new Slot<StateToken>() {
-		    public void onEvent(final StateToken parameter) {
-			contentServiceProvider.get().addFolder(session.getUserHash(),
-				session.getCurrentState().getGroup().getShortName(), new Long(parameter.getFolder()),
-				textDescription, contentTypeId, new AsyncCallbackSimple<StateDTO>() {
+		    public void onEvent(final StateToken stateToken) {
+			Site.showProgressProcessing();
+			contentServiceProvider.get().addFolder(session.getUserHash(), stateToken, textDescription,
+				contentTypeId, new AsyncCallbackSimple<StateDTO>() {
+
 				    public void onSuccess(final StateDTO state) {
-					contextNavigator.setState(state);
+					contextNavigator.setEditOnNextStateChange(true);
 					stateManager.setRetrievedState(state);
-					contextNavigator.editItem(state.getStateToken());
 				    }
 				});
 		    }
@@ -279,7 +303,10 @@
 	uploadFile = new ActionButtonDescriptor<StateToken>(AccessRolDTO.Editor, ActionPosition.bootombarAndItemMenu,
 		new Slot<StateToken>() {
 		    public void onEvent(final StateToken token) {
-			fileUploaderProvider.get().setPermittedExtensions(permitedExtensions);
+			if (permitedExtensions != null) {
+			    Log.info("Permited extensions (in dev): " + permitedExtensions);
+			    fileUploaderProvider.get().setPermittedExtensions(permitedExtensions);
+			}
 			fileUploaderProvider.get().show();
 		    }
 		});

Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -105,8 +105,7 @@
 
     public void onDeleteClicked() {
 	Site.showProgressProcessing();
-	contentServiceProvider.get().delContent(session.getUserHash(),
-		session.getCurrentState().getGroup().getShortName(), content.getDocumentId(),
+	contentServiceProvider.get().delContent(session.getUserHash(), content.getStateToken(),
 		new AsyncCallbackSimple<Object>() {
 		    public void onSuccess(final Object result) {
 			Site.hideProgress();
@@ -154,8 +153,8 @@
     public void onSave(final String text) {
 	content.setContent(text);
 	Site.showProgressSaving();
-	contentServiceProvider.get().save(session.getUserHash(), session.getCurrentState().getGroup().getShortName(),
-		content.getDocumentId(), content.getContent(), new AsyncCallback<Integer>() {
+	contentServiceProvider.get().save(session.getUserHash(), content.getStateToken(), content.getContent(),
+		new AsyncCallback<Integer>() {
 		    public void onFailure(final Throwable caught) {
 			Site.hideProgress();
 			try {

Modified: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextPresenter.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/AdminContextPresenter.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -65,8 +65,8 @@
     public void addAuthor(final String authorShortName) {
 	Site.showProgressProcessing();
 	final StateDTO currentState = session.getCurrentState();
-	contentServiceProvider.get().addAuthor(session.getUserHash(), currentState.getGroup().getShortName(),
-		currentState.getDocumentId(), authorShortName, new AsyncCallbackSimple<Object>() {
+	contentServiceProvider.get().addAuthor(session.getUserHash(), currentState.getStateToken(), authorShortName,
+		new AsyncCallbackSimple<Object>() {
 		    public void onSuccess(final Object result) {
 			Site.hideProgress();
 			stateManager.reload();
@@ -77,8 +77,8 @@
     public void delAuthor(final String authorShortName) {
 	Site.showProgressProcessing();
 	final StateDTO currentState = session.getCurrentState();
-	contentServiceProvider.get().removeAuthor(session.getUserHash(), currentState.getGroup().getShortName(),
-		currentState.getDocumentId(), authorShortName, new AsyncCallbackSimple<Object>() {
+	contentServiceProvider.get().removeAuthor(session.getUserHash(), currentState.getStateToken(), authorShortName,
+		new AsyncCallbackSimple<Object>() {
 		    public void onSuccess(final Object result) {
 			Site.hideProgress();
 			stateManager.reload();
@@ -89,8 +89,8 @@
     public void doChangeLanguage(final String langCode) {
 	Site.showProgressProcessing();
 	final StateDTO currentState = session.getCurrentState();
-	contentServiceProvider.get().setLanguage(session.getUserHash(), currentState.getGroup().getShortName(),
-		currentState.getDocumentId(), langCode, new AsyncCallbackSimple<I18nLanguageDTO>() {
+	contentServiceProvider.get().setLanguage(session.getUserHash(), currentState.getStateToken(), langCode,
+		new AsyncCallbackSimple<I18nLanguageDTO>() {
 		    public void onSuccess(final I18nLanguageDTO lang) {
 			Site.hideProgress();
 			entitySubTitle.setContentLanguage(lang.getEnglishName());
@@ -109,8 +109,8 @@
     public void setPublishedOn(final Date publishedOn) {
 	Site.showProgressProcessing();
 	final StateDTO currentState = session.getCurrentState();
-	contentServiceProvider.get().setPublishedOn(session.getUserHash(), currentState.getGroup().getShortName(),
-		currentState.getDocumentId(), publishedOn, new AsyncCallbackSimple<Object>() {
+	contentServiceProvider.get().setPublishedOn(session.getUserHash(), currentState.getStateToken(), publishedOn,
+		new AsyncCallbackSimple<Object>() {
 		    public void onSuccess(final Object result) {
 			Site.hideProgress();
 			entityTitle.setContentDate(publishedOn);
@@ -159,8 +159,8 @@
     public void setTags(final String tagsString) {
 	Site.showProgressProcessing();
 	final StateDTO currentState = session.getCurrentState();
-	contentServiceProvider.get().setTags(session.getUserHash(), currentState.getGroup().getShortName(),
-		currentState.getDocumentId(), tagsString, new AsyncCallbackSimple<List<TagResultDTO>>() {
+	contentServiceProvider.get().setTags(session.getUserHash(), currentState.getStateToken(), tagsString,
+		new AsyncCallbackSimple<List<TagResultDTO>>() {
 		    public void onSuccess(final List<TagResultDTO> result) {
 			tagsSummaryProvider.get().setGroupTags(result);
 			Site.hideProgress();

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -20,7 +20,6 @@
 
 package org.ourproject.kune.platf.client.dto;
 
-
 import com.google.gwt.user.client.rpc.IsSerializable;
 
 public class GroupDTO implements IsSerializable {
@@ -30,9 +29,7 @@
     private String longName;
     private String publicDesc;
     private GroupType type;
-    private String defaultToolName;
-    private Long defaultFolderId;
-    private Long defaultContentId;
+    private ContentDTO defaultContent;
     private LicenseDTO defaultLicense;
     private String workspaceTheme;
     private String tags;
@@ -56,20 +53,6 @@
 	    return false;
 	}
 	final GroupDTO other = (GroupDTO) obj;
-	if (defaultContentId == null) {
-	    if (other.defaultContentId != null) {
-		return false;
-	    }
-	} else if (!defaultContentId.equals(other.defaultContentId)) {
-	    return false;
-	}
-	if (defaultFolderId == null) {
-	    if (other.defaultFolderId != null) {
-		return false;
-	    }
-	} else if (!defaultFolderId.equals(other.defaultFolderId)) {
-	    return false;
-	}
 	if (defaultLicense == null) {
 	    if (other.defaultLicense != null) {
 		return false;
@@ -77,13 +60,6 @@
 	} else if (!defaultLicense.equals(other.defaultLicense)) {
 	    return false;
 	}
-	if (defaultToolName == null) {
-	    if (other.defaultToolName != null) {
-		return false;
-	    }
-	} else if (!defaultToolName.equals(other.defaultToolName)) {
-	    return false;
-	}
 	if (id == null) {
 	    if (other.id != null) {
 		return false;
@@ -118,22 +94,14 @@
 	return true;
     }
 
-    public Long getDefaultContentId() {
-	return defaultContentId;
+    public ContentDTO getDefaultContent() {
+	return defaultContent;
     }
 
-    public Long getDefaultFolderId() {
-	return defaultFolderId;
-    }
-
     public LicenseDTO getDefaultLicense() {
 	return defaultLicense;
     }
 
-    public String getDefaultToolName() {
-	return defaultToolName;
-    }
-
     public Long getId() {
 	return id;
     }
@@ -165,10 +133,7 @@
     public int hashCode() {
 	final int prime = 31;
 	int result = 1;
-	result = prime * result + (defaultContentId == null ? 0 : defaultContentId.hashCode());
-	result = prime * result + (defaultFolderId == null ? 0 : defaultFolderId.hashCode());
 	result = prime * result + (defaultLicense == null ? 0 : defaultLicense.hashCode());
-	result = prime * result + (defaultToolName == null ? 0 : defaultToolName.hashCode());
 	result = prime * result + (id == null ? 0 : id.hashCode());
 	result = prime * result + (longName == null ? 0 : longName.hashCode());
 	result = prime * result + (publicDesc == null ? 0 : publicDesc.hashCode());
@@ -177,22 +142,14 @@
 	return result;
     }
 
-    public void setDefaultContentId(final Long defaultContentId) {
-	this.defaultContentId = defaultContentId;
+    public void setDefaultContent(final ContentDTO defaultContent) {
+	this.defaultContent = defaultContent;
     }
 
-    public void setDefaultFolderId(final Long defaultFolderId) {
-	this.defaultFolderId = defaultFolderId;
-    }
-
     public void setDefaultLicense(final LicenseDTO defaultLicense) {
 	this.defaultLicense = defaultLicense;
     }
 
-    public void setDefaultToolName(final String defaultToolName) {
-	this.defaultToolName = defaultToolName;
-    }
-
     public void setId(final Long id) {
 	this.id = id;
     }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentService.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentService.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -24,6 +24,7 @@
 import java.util.List;
 
 import org.ourproject.kune.platf.client.dto.CommentDTO;
+import org.ourproject.kune.platf.client.dto.ContentDTO;
 import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
 import org.ourproject.kune.platf.client.dto.StateDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
@@ -34,48 +35,45 @@
 
 public interface ContentService extends RemoteService {
 
-    void addAuthor(String userHash, String groupShortName, String documentId, String authorShortName)
+    void addAuthor(String userHash, StateToken token, String authorShortName) throws DefaultException;
+
+    CommentDTO addComment(String userHash, StateToken token, Long parentCommentId, String commentText)
 	    throws DefaultException;
 
-    CommentDTO addComment(String userHash, String groupShortName, String documentId, Long parentCommentId,
-	    String commentText) throws DefaultException;
+    CommentDTO addComment(String userHash, StateToken token, String commentText) throws DefaultException;
 
-    CommentDTO addComment(String userHash, String groupShortName, String documentId, String commentText)
-	    throws DefaultException;
+    StateDTO addContent(String user, StateToken parentToken, String name) throws DefaultException;
 
-    StateDTO addContent(String user, String groupShortName, Long parentFolderId, String name) throws DefaultException;
+    StateDTO addFolder(String hash, StateToken parentToken, String typeId, String title) throws DefaultException;
 
-    StateDTO addFolder(String hash, String groupShortName, Long parentFolderId, String typeId, String title)
-	    throws DefaultException;
+    StateDTO addRoom(String user, StateToken parentToken, String name) throws DefaultException;
 
-    StateDTO addRoom(String user, String groupShortName, Long parentFolderId, String name) throws DefaultException;
+    void delContent(String userHash, StateToken token) throws DefaultException;
 
-    void delContent(String userHash, String groupShortName, String documentId) throws DefaultException;
+    StateDTO getContent(String userHash, StateToken token) throws DefaultException;
 
-    StateDTO getContent(String userHash, String groupShortName, StateToken token) throws DefaultException;
+    List<TagResultDTO> getSummaryTags(String userHash, StateToken groupToken) throws DefaultException;
 
-    List<TagResultDTO> getSummaryTags(String userHash, String groupShortName) throws DefaultException;
+    CommentDTO markCommentAsAbuse(String userHash, StateToken token, Long commentId) throws DefaultException;
 
-    CommentDTO markCommentAsAbuse(String userHash, String groupShortName, String documentId, Long commentId)
-	    throws DefaultException;
+    void rateContent(String userHash, StateToken token, Double value) throws DefaultException;
 
-    void rateContent(String userHash, String groupShortName, String documentId, Double value) throws DefaultException;
+    void removeAuthor(String userHash, StateToken token, String authorShortName) throws DefaultException;
 
-    void removeAuthor(String userHash, String groupShortName, String documentId, String authorShortName)
-	    throws DefaultException;
+    String renameContainer(String userHash, StateToken token, String newName) throws DefaultException;
 
-    String rename(String userHash, String groupShortName, String token, String newName) throws DefaultException;
+    String renameContent(String userHash, StateToken token, String newName) throws DefaultException;
 
-    Integer save(String user, String groupShortName, String documentId, String content) throws DefaultException;
+    Integer save(String user, StateToken token, String content) throws DefaultException;
 
-    I18nLanguageDTO setLanguage(String userHash, String groupShortName, String documentId, String languageCode)
-	    throws DefaultException;
+    ContentDTO setAsDefaultContent(String userHash, StateToken token);
 
-    void setPublishedOn(String userHash, String groupShortName, String documentId, Date date) throws DefaultException;
+    I18nLanguageDTO setLanguage(String userHash, StateToken token, String languageCode) throws DefaultException;
 
-    List<TagResultDTO> setTags(String userHash, String groupShortName, String documentId, String tags)
-	    throws DefaultException;
+    void setPublishedOn(String userHash, StateToken token, Date date) throws DefaultException;
 
-    CommentDTO voteComment(String userHash, String groupShortName, String documentId, Long commentId,
-	    boolean votePositive) throws DefaultException;
+    List<TagResultDTO> setTags(String userHash, StateToken token, String tags) throws DefaultException;
+
+    CommentDTO voteComment(String userHash, StateToken token, Long commentId, boolean votePositive)
+	    throws DefaultException;
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentServiceAsync.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentServiceAsync.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentServiceAsync.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -24,6 +24,7 @@
 import java.util.List;
 
 import org.ourproject.kune.platf.client.dto.CommentDTO;
+import org.ourproject.kune.platf.client.dto.ContentDTO;
 import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
 import org.ourproject.kune.platf.client.dto.StateDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
@@ -33,53 +34,46 @@
 
 public interface ContentServiceAsync {
 
-    void addAuthor(String userHash, String groupShortName, String documentId, String authorShortName,
-	    AsyncCallback<?> asyncCallback);
+    void addAuthor(String userHash, StateToken token, String authorShortName, AsyncCallback<?> asyncCallback);
 
-    void addComment(String userHash, String groupShortName, String documentId, Long parentCommentId,
-	    String commentText, AsyncCallback<CommentDTO> asyncCallback);
-
-    void addComment(String userHash, String groupShortName, String documentId, String commentText,
+    void addComment(String userHash, StateToken token, Long parentCommentId, String commentText,
 	    AsyncCallback<CommentDTO> asyncCallback);
 
-    void addContent(String user, String groupShortName, Long parentFolderId, String name,
-	    AsyncCallback<StateDTO> callback);
+    void addComment(String userHash, StateToken token, String commentText, AsyncCallback<CommentDTO> asyncCallback);
 
-    void addFolder(String hash, String groupShortName, Long parentFolderId, String title, String typeId,
-	    AsyncCallback<StateDTO> callback);
+    void addContent(String user, StateToken parentToken, String name, AsyncCallback<StateDTO> callback);
 
-    void addRoom(String user, String groupShortName, Long parentFolderId, String name, AsyncCallback<StateDTO> callback);
+    void addFolder(String hash, StateToken parentToken, String title, String typeId, AsyncCallback<StateDTO> callback);
 
-    void delContent(String userHash, String groupShortName, String documentId, AsyncCallback<?> asyncCallback);
+    void addRoom(String user, StateToken parentToken, String name, AsyncCallback<StateDTO> callback);
 
-    void getContent(String user, String groupShortName, StateToken newState, AsyncCallback<StateDTO> callback);
+    void delContent(String userHash, StateToken token, AsyncCallback<?> asyncCallback);
 
-    void getSummaryTags(String userHash, String groupShortName, AsyncCallback<List<TagResultDTO>> asyncCallback);
+    void getContent(String user, StateToken newState, AsyncCallback<StateDTO> callback);
 
-    void markCommentAsAbuse(String userHash, String groupShortName, String documentId, Long commentId,
-	    AsyncCallback<CommentDTO> asyncCallback);
+    void getSummaryTags(String userHash, StateToken groupToken, AsyncCallback<List<TagResultDTO>> asyncCallback);
 
-    void rateContent(String userHash, String groupShortName, String documentId, Double value,
-	    AsyncCallback<?> asyncCallback);
+    void markCommentAsAbuse(String userHash, StateToken token, Long commentId, AsyncCallback<CommentDTO> asyncCallback);
 
-    void removeAuthor(String userHash, String groupShortName, String documentId, String authorShortName,
-	    AsyncCallback<?> asyncCallback);
+    void rateContent(String userHash, StateToken token, Double value, AsyncCallback<?> asyncCallback);
 
-    void rename(String userHash, String groupShortName, String token, String newName,
-	    AsyncCallback<String> asyncCallback);
+    void removeAuthor(String userHash, StateToken token, String authorShortName, AsyncCallback<?> asyncCallback);
 
-    void save(String user, String groupShortName, String documentId, String content,
-	    AsyncCallback<Integer> asyncCallback);
+    void renameContainer(String userHash, StateToken token, String newName, AsyncCallback<String> asyncCallback);
 
-    void setLanguage(String userHash, String groupShortName, String documentId, String languageCode,
+    void renameContent(String userHash, StateToken token, String newName, AsyncCallback<String> asyncCallback);
+
+    void save(String user, StateToken token, String content, AsyncCallback<Integer> asyncCallback);
+
+    void setAsDefaultContent(String userHash, StateToken token, AsyncCallback<ContentDTO> asyncCallback);
+
+    void setLanguage(String userHash, StateToken token, String languageCode,
 	    AsyncCallback<I18nLanguageDTO> asyncCallback);
 
-    void setPublishedOn(String userHash, String groupShortName, String documentId, Date publishedOn,
-	    AsyncCallback<?> asyncCallback);
+    void setPublishedOn(String userHash, StateToken token, Date publishedOn, AsyncCallback<?> asyncCallback);
 
-    void setTags(String userHash, String groupShortName, String documentId, String tags,
-	    AsyncCallback<List<TagResultDTO>> asyncCallback);
+    void setTags(String userHash, StateToken token, String tags, AsyncCallback<List<TagResultDTO>> asyncCallback);
 
-    void voteComment(String userHash, String groupShortName, String documentId, Long commentId, boolean votePositive,
+    void voteComment(String userHash, StateToken token, Long commentId, boolean votePositive,
 	    AsyncCallback<CommentDTO> asyncCallback);
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/rpc/GroupService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/rpc/GroupService.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/rpc/GroupService.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -28,7 +28,7 @@
 
 public interface GroupService extends RemoteService {
 
-    void changeGroupWsTheme(String userHash, String groupShortName, String theme) throws DefaultException;
+    void changeGroupWsTheme(String userHash, StateToken groupToken, String theme) throws DefaultException;
 
     StateToken createNewGroup(String userHash, GroupDTO group) throws DefaultException;
 

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/rpc/GroupServiceAsync.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/rpc/GroupServiceAsync.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/rpc/GroupServiceAsync.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -27,8 +27,8 @@
 
 public interface GroupServiceAsync {
 
+    void changeGroupWsTheme(String userHash, StateToken groupToken, String theme, AsyncCallback<?> callback);
+
     void createNewGroup(String userHash, GroupDTO group, AsyncCallback<StateToken> callback);
 
-    void changeGroupWsTheme(String userHash, String groupShortName, String theme, AsyncCallback<?> callback);
-
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkService.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkService.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -23,41 +23,42 @@
 import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
 import org.ourproject.kune.platf.client.dto.SocialNetworkRequestResult;
 import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.errors.DefaultException;
 
 import com.google.gwt.user.client.rpc.RemoteService;
 
 public interface SocialNetworkService extends RemoteService {
 
-    SocialNetworkResultDTO AcceptJoinGroup(String hash, String groupShortName, String groupToAcceptShortName)
+    SocialNetworkResultDTO AcceptJoinGroup(String hash, StateToken groupToken, String groupToAcceptShortName)
 	    throws DefaultException;
 
-    SocialNetworkResultDTO addAdminMember(String hash, String groupShortName, String groupToAddShortName)
+    SocialNetworkResultDTO addAdminMember(String hash, StateToken groupToken, String groupToAddShortName)
 	    throws DefaultException;
 
-    SocialNetworkResultDTO addCollabMember(String hash, String groupShortName, String groupToAddShortName)
+    SocialNetworkResultDTO addCollabMember(String hash, StateToken groupToken, String groupToAddShortName)
 	    throws DefaultException;
 
-    SocialNetworkResultDTO addViewerMember(String hash, String groupShortName, String groupToAddShortName)
+    SocialNetworkResultDTO addViewerMember(String hash, StateToken groupToken, String groupToAddShortName)
 	    throws DefaultException;
 
-    SocialNetworkResultDTO deleteMember(String hash, String groupShortName, String groupToDeleteShortName)
+    SocialNetworkResultDTO deleteMember(String hash, StateToken groupToken, String groupToDeleteShortName)
 	    throws DefaultException;
 
-    SocialNetworkResultDTO denyJoinGroup(String hash, String groupShortName, String groupToDenyShortName)
+    SocialNetworkResultDTO denyJoinGroup(String hash, StateToken groupToken, String groupToDenyShortName)
 	    throws DefaultException;
 
-    SocialNetworkDTO getGroupMembers(String hash, String groupShortName) throws DefaultException;
+    SocialNetworkDTO getGroupMembers(String hash, StateToken groupToken) throws DefaultException;
 
-    ParticipationDataDTO getParticipation(String hash, String groupShortName) throws DefaultException;
+    ParticipationDataDTO getParticipation(String hash, StateToken groupToken) throws DefaultException;
 
-    SocialNetworkRequestResult requestJoinGroup(String hash, String groupShortName) throws DefaultException;
+    SocialNetworkRequestResult requestJoinGroup(String hash, StateToken groupToken) throws DefaultException;
 
-    SocialNetworkResultDTO setAdminAsCollab(String hash, String groupShortName, String groupToSetCollabShortName)
+    SocialNetworkResultDTO setAdminAsCollab(String hash, StateToken groupToken, String groupToSetCollabShortName)
 	    throws DefaultException;
 
-    SocialNetworkResultDTO setCollabAsAdmin(String hash, String groupShortName, String groupToSetAdminShortName)
+    SocialNetworkResultDTO setCollabAsAdmin(String hash, StateToken groupToken, String groupToSetAdminShortName)
 	    throws DefaultException;
 
-    SocialNetworkResultDTO unJoinGroup(String hash, String groupShortName) throws DefaultException;
+    SocialNetworkResultDTO unJoinGroup(String hash, StateToken groupToken) throws DefaultException;
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkServiceAsync.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkServiceAsync.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/rpc/SocialNetworkServiceAsync.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -21,40 +21,41 @@
 
 import org.ourproject.kune.platf.client.dto.ParticipationDataDTO;
 import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
 
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
 public interface SocialNetworkServiceAsync {
 
-    void requestJoinGroup(String hash, String groupShortName, AsyncCallback<?> callback);
+    void AcceptJoinGroup(String hash, StateToken groupToken, String groupToAcceptShortName,
+	    AsyncCallback<SocialNetworkResultDTO> callback);
 
-    void AcceptJoinGroup(String hash, String groupShortName, String groupToAcceptShortName,
-            AsyncCallback<SocialNetworkResultDTO> callback);
+    void addAdminMember(String hash, StateToken groupToken, String groupToAddShortName,
+	    AsyncCallback<SocialNetworkResultDTO> callback);
 
-    void deleteMember(String hash, String groupShortName, String groupToDeleteShortName,
-            AsyncCallback<SocialNetworkResultDTO> callback);
+    void addCollabMember(String hash, StateToken groupToken, String groupToAddShortName,
+	    AsyncCallback<SocialNetworkResultDTO> callback);
 
-    void denyJoinGroup(String hash, String groupShortName, String groupToDenyShortName,
-            AsyncCallback<SocialNetworkResultDTO> callback);
+    void addViewerMember(String hash, StateToken groupToken, String groupToAddShortName,
+	    AsyncCallback<SocialNetworkResultDTO> callback);
 
-    void unJoinGroup(String hash, String groupShortName, AsyncCallback<SocialNetworkResultDTO> callback);
+    void deleteMember(String hash, StateToken groupToken, String groupToDeleteShortName,
+	    AsyncCallback<SocialNetworkResultDTO> callback);
 
-    void setCollabAsAdmin(String hash, String groupShortName, String groupToSetAdminShortName,
-            AsyncCallback<SocialNetworkResultDTO> callback);
+    void denyJoinGroup(String hash, StateToken groupToken, String groupToDenyShortName,
+	    AsyncCallback<SocialNetworkResultDTO> callback);
 
-    void setAdminAsCollab(String hash, String groupShortName, String groupToSetCollabShortName,
-            AsyncCallback<SocialNetworkResultDTO> callback);
+    void getGroupMembers(String hash, StateToken groupToken, AsyncCallback<SocialNetworkResultDTO> callback);
 
-    void addAdminMember(String hash, String groupShortName, String groupToAddShortName,
-            AsyncCallback<SocialNetworkResultDTO> callback);
+    void getParticipation(String hash, StateToken groupToken, AsyncCallback<ParticipationDataDTO> callback);
 
-    void addCollabMember(String hash, String groupShortName, String groupToAddShortName,
-            AsyncCallback<SocialNetworkResultDTO> callback);
+    void requestJoinGroup(String hash, StateToken groupToken, AsyncCallback<?> callback);
 
-    void addViewerMember(String hash, String groupShortName, String groupToAddShortName,
-            AsyncCallback<SocialNetworkResultDTO> callback);
+    void setAdminAsCollab(String hash, StateToken groupToken, String groupToSetCollabShortName,
+	    AsyncCallback<SocialNetworkResultDTO> callback);
 
-    void getGroupMembers(String hash, String groupShortName, AsyncCallback<SocialNetworkResultDTO> callback);
+    void setCollabAsAdmin(String hash, StateToken groupToken, String groupToSetAdminShortName,
+	    AsyncCallback<SocialNetworkResultDTO> callback);
 
-    void getParticipation(String hash, String groupShortName, AsyncCallback<ParticipationDataDTO> callback);
+    void unJoinGroup(String hash, StateToken groupToken, AsyncCallback<SocialNetworkResultDTO> callback);
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -36,6 +36,7 @@
 import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator;
 import org.ourproject.kune.workspace.client.ctxnav.ContextNavigatorPanel;
 import org.ourproject.kune.workspace.client.ctxnav.ContextNavigatorPresenter;
+import org.ourproject.kune.workspace.client.ctxnav.ContextNavigatorToolbar;
 import org.ourproject.kune.workspace.client.editor.TextEditor;
 import org.ourproject.kune.workspace.client.editor.TextEditorPanel;
 import org.ourproject.kune.workspace.client.editor.TextEditorPresenter;
@@ -589,9 +590,11 @@
 
 	register(SingletonScope.class, new Factory<ContextNavigator>(ContextNavigator.class) {
 	    public ContextNavigator create() {
+		final ContextNavigatorToolbar contextNavigatorToolbar = new ContextNavigatorToolbar($(Session.class),
+			$$(ActionManager.class), ws);
 		final ContextNavigatorPresenter presenter = new ContextNavigatorPresenter($(StateManager.class),
 			$(Session.class), $$(ContentServiceAsync.class), i18n, $(EntityTitle.class),
-			$$(ActionManager.class));
+			$$(ActionManager.class), contextNavigatorToolbar);
 		final ContextNavigatorPanel panel = new ContextNavigatorPanel(presenter, i18n, ws);
 		presenter.init(panel);
 		return presenter;

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderDefault.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderDefault.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -49,7 +49,7 @@
 	if (catched != null) {
 	    callback.onSuccess(catched);
 	} else {
-	    server.getContent(user, newState.getGroup(), newState, callback);
+	    server.getContent(user, newState, callback);
 	}
     }
 

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -139,9 +139,9 @@
 	siteTokens.remove(token);
     }
 
-    public void setRetrievedState(final StateDTO content) {
-	final StateToken state = content.getStateToken();
-	contentProvider.cache(state, content);
+    public void setRetrievedState(final StateDTO newState) {
+	contentProvider.cache(newState.getStateToken(), newState);
+	setState(newState);
     }
 
     public void setSocialNetwork(final SocialNetworkResultDTO socialNet) {
@@ -171,18 +171,10 @@
 	}
     }
 
-    private void loadContent(final StateDTO state) {
-	onStateChanged.fire(state);
-	Site.hideProgress();
-    }
-
     private void onHistoryChanged(final StateToken newState) {
 	contentProvider.getContent(session.getUserHash(), newState, new AsyncCallbackSimple<StateDTO>() {
 	    public void onSuccess(final StateDTO newState) {
-		loadContent(newState);
-		session.setCurrent(newState);
-		checkGroupAndToolChange(oldState, newState);
-		oldState = newState;
+		setState(newState);
 	    }
 	});
     }
@@ -191,10 +183,17 @@
 	if (oldState == null) {
 	    onHistoryChanged(new StateToken());
 	} else {
-	    final StateDTO currentState = session.getCurrentState();
-	    session.setCurrent(oldState);
-	    checkGroupAndToolChange(currentState, oldState);
-	    loadContent(oldState);
+	    final StateDTO newState = oldState;
+	    oldState = session.getCurrentState();
+	    setState(newState);
 	}
     }
+
+    private void setState(final StateDTO newState) {
+	session.setCurrent(newState);
+	onStateChanged.fire(newState);
+	Site.hideProgress();
+	checkGroupAndToolChange(oldState, newState);
+	oldState = newState;
+    }
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/FileUploaderDialog.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/FileUploaderDialog.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/FileUploaderDialog.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -8,6 +8,8 @@
 
 import com.allen_sauer.gwt.log.client.Log;
 import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.DeferredCommand;
 import com.gwtext.client.core.EventObject;
 import com.gwtext.client.core.UrlParam;
 import com.gwtext.client.widgets.Button;
@@ -20,62 +22,17 @@
 
     private static final String URL = "/services/fileupload";
 
-    private final UploadDialog dialog;
+    private UploadDialog dialog;
     private ToolbarButton traybarButton;
     private final I18nUITranslationService i18n;
     private final WorkspaceSkeleton ws;
+    private final Session session;
 
     public FileUploaderDialog(final I18nUITranslationService i18n, final WorkspaceSkeleton ws, final Session session) {
 	this.i18n = i18n;
 	this.ws = ws;
-	dialog = new UploadDialog(i18n.t("File uploader"), false, true);
-	// dialog.setUploadAutostart(true);
-	dialog.setResetOnHide(false);
-	dialog.addListener(new UploadDialogListenerAdapter() {
-
-	    @Override
-	    public void onFileUploadStart(final UploadDialog source, final String filename) {
-		setUploadParams(session.getUserHash(), session.getCurrentState().getStateToken().toString(), filename);
-	    }
-
-	    @Override
-	    public void onUploadComplete(final UploadDialog source) {
-		if (!dialog.isVisible()) {
-		    Site.info(i18n.t("Upload completed"));
-		    traybarButton.destroy();
-		    traybarButton = null;
-		}
-	    }
-
-	    @Override
-	    public void onUploadError(final UploadDialog source, final String filename, final JavaScriptObject data) {
-		showError();
-	    }
-
-	    @Override
-	    public void onUploadFailed(final UploadDialog source, final String filename) {
-		showError();
-	    }
-
-	    private void setUploadParams(final String userhash, final String currentStateToken, final String filename) {
-		Log.info("Setting upload params");
-		final UrlParam param[] = new UrlParam[3];
-		param[0] = new UrlParam("userhash", userhash);
-		param[1] = new UrlParam("currentStateToken", currentStateToken);
-		param[2] = new UrlParam("filename", filename);
-		dialog.setBaseParams(param);
-		dialog.setPostVarName(filename);
-	    }
-
-	    private void showError() {
-		if (!dialog.isVisible()) {
-		    Site.veryImportant(i18n.t("Error uploading"));
-		}
-	    }
-
-	});
-	dialog.setUrl(URL);
-
+	this.session = session;
+	createDialog(false);
     }
 
     public void hide() {
@@ -83,7 +40,16 @@
     }
 
     public void setPermittedExtensions(final String extensions) {
-	dialog.setPermittedExtensions((String[]) KuneStringUtils.splitTags(extensions).toArray());
+	DeferredCommand.addCommand(new Command() {
+	    public void execute() {
+		final Object[] objs = KuneStringUtils.splitTags(extensions).toArray();
+		final String[] exts = new String[objs.length];
+		for (int i = 0; i < objs.length; i++) {
+		    exts[i] = (String) objs[i];
+		}
+		dialog.setPermittedExtensions(exts);
+	    }
+	});
     }
 
     public void show() {
@@ -103,6 +69,71 @@
 	    });
 	    ws.getSiteTraybar().addButton(traybarButton);
 	}
-	dialog.show();
+	if (dialog == null) {
+	    createDialog(true);
+	} else {
+	    dialog.show();
+	}
     }
+
+    private void createDialog(final boolean show) {
+	DeferredCommand.addCommand(new Command() {
+
+	    public void execute() {
+
+		dialog = new UploadDialog(i18n.t("File uploader"), false, true);
+		// dialog.setUploadAutostart(true);
+		dialog.setResetOnHide(false);
+		dialog.addListener(new UploadDialogListenerAdapter() {
+		    @Override
+		    public void onFileUploadStart(final UploadDialog source, final String filename) {
+			setUploadParams(session.getUserHash(), session.getCurrentState().getStateToken().toString(),
+				filename);
+		    }
+
+		    @Override
+		    public void onUploadComplete(final UploadDialog source) {
+			if (!dialog.isVisible()) {
+			    Site.info(i18n.t("Upload completed"));
+			    traybarButton.destroy();
+			    traybarButton = null;
+			}
+		    }
+
+		    @Override
+		    public void onUploadError(final UploadDialog source, final String filename,
+			    final JavaScriptObject data) {
+			showError();
+		    }
+
+		    @Override
+		    public void onUploadFailed(final UploadDialog source, final String filename) {
+			showError();
+		    }
+
+		    private void setUploadParams(final String userhash, final String currentStateToken,
+			    final String filename) {
+			Log.info("Setting upload params");
+			final UrlParam param[] = new UrlParam[3];
+			param[0] = new UrlParam("userhash", userhash);
+			param[1] = new UrlParam("currentStateToken", currentStateToken);
+			param[2] = new UrlParam("filename", filename);
+			dialog.setBaseParams(param);
+			dialog.setPostVarName(filename);
+		    }
+
+		    private void showError() {
+			if (!dialog.isVisible()) {
+			    Site.veryImportant(i18n.t("Error uploading"));
+			}
+		    }
+
+		});
+		dialog.setUrl(URL);
+		if (show) {
+		    dialog.show();
+		}
+	    }
+	});
+    }
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPresenter.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPresenter.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -85,8 +85,8 @@
 	setRatePanel(newValue);
 	Site.showProgressProcessing();
 	final StateDTO currentState = session.getCurrentState();
-	contentServiceProvider.get().rateContent(session.getUserHash(), currentState.getGroup().getShortName(),
-		currentState.getDocumentId(), newValue, new AsyncCallbackSimple<Object>() {
+	contentServiceProvider.get().rateContent(session.getUserHash(), currentState.getStateToken(), newValue,
+		new AsyncCallbackSimple<Object>() {
 		    public void onSuccess(final Object result) {
 			Site.hideProgress();
 			Site.info(i18n.t("Content rated"));

Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/gallery_add.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/gallery_add.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/room.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/room.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/room_add.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/room_add.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/upload.gif
===================================================================
(Binary files differ)

Modified: trunk/src/main/java/org/ourproject/kune/platf/public/images/nav/upload.png
===================================================================
(Binary files differ)

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/PlatformServerModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/PlatformServerModule.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/PlatformServerModule.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -41,8 +41,6 @@
 import org.ourproject.kune.platf.server.auth.AuthenticatedMethodInterceptor;
 import org.ourproject.kune.platf.server.auth.Authorizated;
 import org.ourproject.kune.platf.server.auth.AuthorizatedMethodInterceptor;
-import org.ourproject.kune.platf.server.auth.GroupAuthorizated;
-import org.ourproject.kune.platf.server.auth.GroupAuthorizatedMethodInterceptor;
 import org.ourproject.kune.platf.server.auth.SessionService;
 import org.ourproject.kune.platf.server.auth.SessionServiceDefault;
 import org.ourproject.kune.platf.server.content.CommentManager;
@@ -116,8 +114,6 @@
 		outermostCall(new AuthenticatedMethodInterceptor()));
 	bindInterceptor(Matchers.any(), Matchers.annotatedWith(Authorizated.class),
 		outermostCall(new AuthorizatedMethodInterceptor()));
-	bindInterceptor(Matchers.any(), Matchers.annotatedWith(GroupAuthorizated.class),
-		outermostCall(new GroupAuthorizatedMethodInterceptor()));
     }
 
     private void bindManagers() {

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/access/Access.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/access/Access.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/access/Access.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -29,17 +29,29 @@
     private Content content;
     private Container container;
     private AccessLists contentAccessLists;
-    private AccessLists folderAccessLists;
+    private AccessLists containerAccessLists;
     private AccessLists groupAccessLists;
     private AccessRights contentRights;
-    private AccessRights folderRights;
+    private AccessRights containerRights;
     private AccessRights groupRights;
 
     public Access(final Content descriptor, final Container container) {
 	setContent(descriptor);
-	setFolder(container);
+	setContainer(container);
     }
 
+    public Container getContainer() {
+	return container;
+    }
+
+    public AccessLists getContainerAccessLists() {
+	return containerAccessLists;
+    }
+
+    public AccessRights getContainerRights() {
+	return containerRights;
+    }
+
     public Content getContent() {
 	return content;
     }
@@ -52,18 +64,6 @@
 	return contentRights;
     }
 
-    public Container getFolder() {
-	return container;
-    }
-
-    public AccessLists getFolderAccessLists() {
-	return folderAccessLists;
-    }
-
-    public AccessRights getFolderRights() {
-	return folderRights;
-    }
-
     public AccessLists getGroupAccessLists() {
 	return groupAccessLists;
     }
@@ -72,18 +72,31 @@
 	return groupRights;
     }
 
+    public boolean hasContainerRights() {
+	return containerRights != null;
+    }
+
     public boolean hasContentRights() {
 	return contentRights != null;
     }
 
-    public boolean hasFolderRights() {
-	return folderRights != null;
-    }
-
     public boolean hasGroupRights() {
 	return groupRights != null;
     }
 
+    public void setContainer(final Container container) {
+	this.container = container;
+	containerAccessLists = container != null ? getContainerAccessLists(container) : null;
+	groupAccessLists = containerAccessLists;
+    }
+
+    public void setContainerRights(final AccessRights accessRights) {
+	this.containerRights = accessRights;
+	if (equalsAccessLists()) {
+	    this.contentRights = accessRights;
+	}
+    }
+
     public void setContent(final Content descriptor) {
 	this.content = descriptor;
 	contentAccessLists = descriptor != null ? getContentAccessList(descriptor) : null;
@@ -92,39 +105,26 @@
     public void setContentRights(final AccessRights accessRights) {
 	this.contentRights = accessRights;
 	if (equalsAccessLists()) {
-	    this.folderRights = accessRights;
+	    this.containerRights = accessRights;
 	}
     }
 
     public void setContentWidthFolderRights(final Content content) {
 	setContent(content);
-	this.contentRights = folderRights;
+	this.contentRights = containerRights;
     }
 
-    public void setFolder(final Container container) {
-	this.container = container;
-	folderAccessLists = container != null ? getFolderAccessLists(container) : null;
-	groupAccessLists = folderAccessLists;
-    }
-
-    public void setFolderRights(final AccessRights accessRights) {
-	this.folderRights = accessRights;
-	if (equalsAccessLists()) {
-	    this.contentRights = accessRights;
-	}
-    }
-
     public void setGroupRights(final AccessRights accessRights) {
 	this.groupRights = accessRights;
     }
 
     private boolean equalsAccessLists() {
-	if (contentAccessLists == folderAccessLists) {
+	if (contentAccessLists == containerAccessLists) {
 	    return true;
 	} else if (contentAccessLists != null) {
-	    return contentAccessLists.equals(folderAccessLists);
+	    return contentAccessLists.equals(containerAccessLists);
 	} else {
-	    return folderAccessLists.equals(contentAccessLists);
+	    return containerAccessLists.equals(contentAccessLists);
 	}
     }
 
@@ -139,7 +139,7 @@
 	return accessLists;
     }
 
-    private AccessLists getFolderAccessLists(final Container container) {
+    private AccessLists getContainerAccessLists(final Container container) {
 	return container.getOwner().getSocialNetwork().getAccessLists();
     }
 

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessService.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessService.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -22,16 +22,17 @@
 
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.errors.DefaultException;
+import org.ourproject.kune.platf.server.domain.Container;
 import org.ourproject.kune.platf.server.domain.Content;
 import org.ourproject.kune.platf.server.domain.Group;
 import org.ourproject.kune.platf.server.domain.User;
 
 public interface AccessService {
 
-    Content accessToContent(Long contentId, User user, AccessType accessType) throws DefaultException;
+    Container accessToContainer(Long folderId, User user, AccessRol accessRol) throws DefaultException;
 
-    Access getAccess(User user, StateToken token, Group defaultGroup, AccessType accessType) throws DefaultException;
+    Content accessToContent(Long contentId, User user, AccessRol accessRol) throws DefaultException;
 
-    Access getFolderAccess(Group group, Long folderId, User user, AccessType accessType) throws DefaultException;
+    Access getAccess(User user, StateToken token, Group defaultGroup, AccessRol accessRol) throws DefaultException;
 
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessServiceDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessServiceDefault.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessServiceDefault.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -49,40 +49,37 @@
 	this.groupFinder = groupFinder;
     }
 
-    public Content accessToContent(final Long contentId, final User user, final AccessType accessType)
+    public Container accessToContainer(final Long folderId, final User user, final AccessRol accessRol)
 	    throws DefaultException {
+	final Container folder = finder.getFolder(folderId);
+	final Access access = new Access(null, folder);
+	addFolderRights(access, user);
+	addGroupRights(access, user);
+	return check(access, access.getContainerRights(), accessRol).getContainer();
+    }
+
+    public Content accessToContent(final Long contentId, final User user, final AccessRol accessRol)
+	    throws DefaultException {
 	final Content descriptor = finder.getContent(contentId);
 	final Access access = new Access(descriptor, null);
 	addContentRights(access, user);
-	return check(access, access.getContentRights(), accessType).getContent();
+	return check(access, access.getContentRights(), accessRol).getContent();
     }
 
-    public Access getAccess(final User user, final StateToken token, final Group defaultGroup,
-	    final AccessType accessType) throws DefaultException {
+    public Access getAccess(final User user, final StateToken token, final Group defaultGroup, final AccessRol accessRol)
+	    throws DefaultException {
 	checkGroupExistence(token);
 	final Content descriptor = finder.getContent(token, defaultGroup);
 	final Access access = new Access(descriptor, descriptor.getContainer());
 	addContentRights(access, user);
 	addFolderRights(access, user);
 	addGroupRights(access, user);
-	if (!isValid(accessType, access.getContentRights()) || !isValid(accessType, access.getFolderRights())) {
+	if (!isValid(accessRol, access.getContentRights()) || !isValid(accessRol, access.getContainerRights())) {
 	    throw new AccessViolationException();
 	}
 	return access;
     }
 
-    public Access getFolderAccess(final Group group, final Long folderId, final User user, final AccessType accessType)
-	    throws DefaultException {
-	final Container folder = finder.getFolder(folderId);
-	if (!folder.getOwner().equals(group)) {
-	    throw new AccessViolationException();
-	}
-	final Access access = new Access(null, folder);
-	addFolderRights(access, user);
-	addGroupRights(access, user);
-	return check(access, access.getFolderRights(), accessType);
-    }
-
     private void addContentRights(final Access access, final User user) {
 	if (!access.hasContentRights()) {
 	    access.setContentRights(accessRightsService.get(user, access.getContentAccessLists()));
@@ -90,8 +87,8 @@
     }
 
     private void addFolderRights(final Access access, final User user) {
-	if (!access.hasFolderRights()) {
-	    access.setFolderRights(accessRightsService.get(user, access.getFolderAccessLists()));
+	if (!access.hasContainerRights()) {
+	    access.setContainerRights(accessRightsService.get(user, access.getContainerAccessLists()));
 	}
     }
 
@@ -101,9 +98,9 @@
 	}
     }
 
-    private Access check(final Access access, final AccessRights rights, final AccessType accessType)
+    private Access check(final Access access, final AccessRights rights, final AccessRol accessRol)
 	    throws AccessViolationException {
-	if (!isValid(accessType, rights)) {
+	if (!isValid(accessRol, rights)) {
 	    throw new AccessViolationException();
 	}
 	return access;
@@ -120,13 +117,13 @@
 	}
     }
 
-    private boolean isValid(final AccessType accessType, final AccessRights rights) {
-	switch (accessType) {
-	case READ:
+    private boolean isValid(final AccessRol accessRol, final AccessRights rights) {
+	switch (accessRol) {
+	case Viewer:
 	    return rights.isVisible();
-	case EDIT:
+	case Editor:
 	    return rights.isEditable();
-	case ADMIN:
+	case Administrator:
 	    return rights.isAdministrable();
 	default:
 	    return false;

Deleted: trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessType.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessType.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessType.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -1,28 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/**
- *
- */
-package org.ourproject.kune.platf.server.access;
-
-public enum AccessType {
-    READ, EDIT, ADMIN;
-}
\ No newline at end of file

Added: trunk/src/main/java/org/ourproject/kune/platf/server/auth/ActionLevel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/auth/ActionLevel.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/auth/ActionLevel.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -0,0 +1,5 @@
+package org.ourproject.kune.platf.server.auth;
+
+public enum ActionLevel {
+    group, tool, container, content
+}

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/auth/Authorizated.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/auth/Authorizated.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/auth/Authorizated.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -23,7 +23,7 @@
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 
-import org.ourproject.kune.platf.server.access.AccessType;
+import org.ourproject.kune.platf.server.access.AccessRol;
 
 import com.google.inject.BindingAnnotation;
 
@@ -40,8 +40,13 @@
 @Retention(RetentionPolicy.RUNTIME)
 public @interface Authorizated {
 
-    AccessType accessTypeRequired() default AccessType.READ;
+    AccessRol accessRolRequired() default AccessRol.Viewer;
 
-    boolean checkContent() default false;
+    /**
+     * If the action is over a "group", "tool", "container" or over the content.
+     * 
+     * @return
+     */
+    ActionLevel actionLevel() default ActionLevel.content;
 
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptor.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptor.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -23,97 +23,108 @@
 
 import org.aopalliance.intercept.MethodInterceptor;
 import org.aopalliance.intercept.MethodInvocation;
+import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.errors.AccessViolationException;
 import org.ourproject.kune.platf.client.errors.ContentNotFoundException;
 import org.ourproject.kune.platf.server.UserSession;
+import org.ourproject.kune.platf.server.access.AccessRights;
+import org.ourproject.kune.platf.server.access.AccessRightsService;
+import org.ourproject.kune.platf.server.access.AccessRol;
 import org.ourproject.kune.platf.server.access.AccessService;
-import org.ourproject.kune.platf.server.access.AccessType;
+import org.ourproject.kune.platf.server.domain.Container;
 import org.ourproject.kune.platf.server.domain.Content;
 import org.ourproject.kune.platf.server.domain.Group;
-import org.ourproject.kune.platf.server.domain.SocialNetwork;
 import org.ourproject.kune.platf.server.domain.User;
 import org.ourproject.kune.platf.server.manager.GroupManager;
 
 import com.google.inject.Inject;
 import com.google.inject.Provider;
+import com.google.inject.Singleton;
 
+ at Singleton
 public class AuthorizatedMethodInterceptor implements MethodInterceptor {
 
     @Inject
-    Provider<UserSession> userSessionProvider;
+    private Provider<UserSession> userSessionProvider;
     @Inject
-    Provider<GroupManager> groupManagerProvider;
+    private Provider<GroupManager> groupManagerProvider;
     @Inject
-    Provider<AccessService> accessServiceProvider;
+    private Provider<AccessRightsService> accessRightsServiceProvider;
+    @Inject
+    private Provider<AccessService> accessServiceProvider;
 
     public Object invoke(final MethodInvocation invocation) throws Throwable {
-        Object[] arguments = invocation.getArguments();
-        String groupShortName = (String) arguments[1];
+	final Object[] arguments = invocation.getArguments();
+	final StateToken token = (StateToken) arguments[1];
 
-        UserSession userSession = userSessionProvider.get();
-        GroupManager groupManager = groupManagerProvider.get();
-        AccessService accessService = accessServiceProvider.get();
+	final UserSession userSession = userSessionProvider.get();
+	final GroupManager groupManager = groupManagerProvider.get();
+	final AccessService accessService = accessServiceProvider.get();
 
-        Authorizated authoAnnotation = invocation.getStaticPart().getAnnotation(Authorizated.class);
-        AccessType accessType = authoAnnotation.accessTypeRequired();
-        boolean checkContent = authoAnnotation.checkContent();
+	final Authorizated authoAnnotation = invocation.getStaticPart().getAnnotation(Authorizated.class);
+	final AccessRol accessRol = authoAnnotation.accessRolRequired();
+	final ActionLevel actionLevel = authoAnnotation.actionLevel();
 
-        User user = userSession.getUser();
-        Group group = Group.NO_GROUP;
-        try {
-            group = groupManager.findByShortName(groupShortName);
-        } catch (NoResultException e) {
-            // continue, and check later
-        }
+	final User user = userSession.getUser();
+	Group group = Group.NO_GROUP;
+	try {
+	    group = groupManager.findByShortName(token.getGroup());
+	} catch (final NoResultException e) {
+	    // continue, and check later
+	}
 
-        if (checkContent) {
-            String contentIdS = (String) arguments[2];
-            Long contentId = parseId(contentIdS);
-            Content content = accessService.accessToContent(contentId, user, accessType);
-            if (!content.getContainer().getOwner().equals(group)) {
-                throw new AccessViolationException();
-            }
-        }
+	switch (actionLevel) {
+	case content:
+	default:
+	    final Content content = accessService.accessToContent(parseId(token.getDocument()), user, accessRol);
+	    if (!content.getContainer().getOwner().equals(group)) {
+		throw new AccessViolationException();
+	    }
+	    if (!content.getContainer().getId().equals(parseId(token.getFolder()))) {
+		throw new AccessViolationException();
+	    }
+	    if (!content.getContainer().getToolName().equals(token.getTool())) {
+		throw new AccessViolationException();
+	    }
+	case container:
+	    final Container container = accessService.accessToContainer(parseId(token.getFolder()), user, accessRol);
+	    if (!container.getOwner().equals(group)) {
+		throw new AccessViolationException();
+	    }
+	case tool:
+	case group:
+	    break;
+	}
 
-        if (!correctMember(user, group, accessType)) {
-            throw new AccessViolationException();
-        }
+	if (!correctMember(user, group, accessRol)) {
+	    throw new AccessViolationException();
+	}
 
-        Object result = invocation.proceed();
-        return result;
+	return invocation.proceed();
     }
 
-    private boolean correctMember(final User user, final Group group, final AccessType memberType)
-            throws AccessViolationException {
-        boolean correctMember = false;
+    private boolean correctMember(final User user, final Group group, final AccessRol memberType)
+	    throws AccessViolationException {
 
-        if (group == Group.NO_GROUP) {
-            throw new AccessViolationException();
-        }
-        SocialNetwork sn = group.getSocialNetwork();
-        Group userGroup;
+	final AccessRights accessRights = accessRightsServiceProvider.get().get(user,
+		group.getSocialNetwork().getAccessLists());
 
-        if (user == null) {
-            userGroup = Group.NO_GROUP;
-        } else {
-            userGroup = user.getUserGroup();
-        }
-
-        if (memberType.equals(AccessType.ADMIN)) {
-            correctMember = sn.isAdmin(userGroup);
-        } else if (memberType.equals(AccessType.EDIT)) {
-            correctMember = sn.isCollab(userGroup) || sn.isAdmin(userGroup);
-        } else if (memberType.equals(AccessType.READ)) {
-            correctMember = sn.isViewer(userGroup) || sn.isCollab(userGroup) || sn.isAdmin(userGroup);
-        }
-        return correctMember;
+	switch (memberType) {
+	case Administrator:
+	    return accessRights.isAdministrable();
+	case Editor:
+	    return accessRights.isEditable();
+	default:
+	    return accessRights.isVisible();
+	}
     }
 
     private Long parseId(final String documentId) throws ContentNotFoundException {
-        try {
-            return new Long(documentId);
-        } catch (final NumberFormatException e) {
-            throw new ContentNotFoundException();
-        }
+	try {
+	    return new Long(documentId);
+	} catch (final NumberFormatException e) {
+	    throw new ContentNotFoundException();
+	}
     }
+
 }

Deleted: trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizated.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizated.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizated.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -1,44 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-package org.ourproject.kune.platf.server.auth;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-import org.ourproject.kune.platf.server.access.AccessType;
-
-import com.google.inject.BindingAnnotation;
-
-/**
- * Use in RPC methods, for instance: <code>
- * Authorizated(authLevelRequired = AuthLevelRequired.COLLAB, checkContent = true) </code>
- * 
- * The first parameter in the method must be the userHash, the second parameter
- * must be a content token
- * 
- */
- at BindingAnnotation
- at Retention(RetentionPolicy.RUNTIME)
-public @interface ContentAuthorizated {
-
-    AccessType accessTypeRequired() default AccessType.READ;
-
-}

Deleted: trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizatedMethodInterceptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizatedMethodInterceptor.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/auth/ContentAuthorizatedMethodInterceptor.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -1,85 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.platf.server.auth;
-
-import javax.persistence.NoResultException;
-
-import org.aopalliance.intercept.MethodInterceptor;
-import org.aopalliance.intercept.MethodInvocation;
-import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.platf.client.errors.AccessViolationException;
-import org.ourproject.kune.platf.client.errors.ContentNotFoundException;
-import org.ourproject.kune.platf.server.UserSession;
-import org.ourproject.kune.platf.server.access.AccessService;
-import org.ourproject.kune.platf.server.access.AccessType;
-import org.ourproject.kune.platf.server.domain.Content;
-import org.ourproject.kune.platf.server.domain.Group;
-import org.ourproject.kune.platf.server.domain.User;
-import org.ourproject.kune.platf.server.manager.GroupManager;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-
-public class ContentAuthorizatedMethodInterceptor implements MethodInterceptor {
-
-    @Inject
-    Provider<UserSession> userSessionProvider;
-    @Inject
-    Provider<GroupManager> groupManagerProvider;
-    @Inject
-    Provider<AccessService> accessServiceProvider;
-
-    public Object invoke(final MethodInvocation invocation) throws Throwable {
-	final Object[] arguments = invocation.getArguments();
-	final String groupShortName = (String) arguments[1];
-
-	final UserSession userSession = userSessionProvider.get();
-	final GroupManager groupManager = groupManagerProvider.get();
-	final AccessService accessService = accessServiceProvider.get();
-
-	final ContentAuthorizated authoAnnotation = invocation.getStaticPart().getAnnotation(ContentAuthorizated.class);
-	final AccessType accessType = authoAnnotation.accessTypeRequired();
-
-	final User user = userSession.getUser();
-	Group group = Group.NO_GROUP;
-	try {
-	    group = groupManager.findByShortName(groupShortName);
-	} catch (final NoResultException e) {
-	    // continue, and check later
-	}
-	final StateToken contentToken = (StateToken) arguments[2];
-	final Long contentId = parseId(contentToken.getDocument());
-
-	final Content content = accessService.accessToContent(contentId, user, accessType);
-	if (!content.getContainer().getOwner().equals(group)) {
-	    throw new AccessViolationException();
-	}
-	final Object result = invocation.proceed();
-	return result;
-    }
-
-    private Long parseId(final String documentId) throws ContentNotFoundException {
-	try {
-	    return new Long(documentId);
-	} catch (final NumberFormatException e) {
-	    throw new ContentNotFoundException();
-	}
-    }
-}

Deleted: trunk/src/main/java/org/ourproject/kune/platf/server/auth/GroupAuthorizated.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/auth/GroupAuthorizated.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/auth/GroupAuthorizated.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -1,24 +0,0 @@
-package org.ourproject.kune.platf.server.auth;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-import org.ourproject.kune.platf.server.access.AccessType;
-
-import com.google.inject.BindingAnnotation;
-
-/**
- * Use in RPC methods, for instance: <code>
- * GroupAuthorizated(authLevelRequired = AuthLevelRequired.COLLAB) </code>
- * 
- * The first parameter in the method must be the userHash, the second the group
- * shortName
- * 
- */
- at BindingAnnotation
- at Retention(RetentionPolicy.RUNTIME)
-public @interface GroupAuthorizated {
-
-    AccessType accessTypeRequired() default AccessType.READ;
-
-}

Deleted: trunk/src/main/java/org/ourproject/kune/platf/server/auth/GroupAuthorizatedMethodInterceptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/auth/GroupAuthorizatedMethodInterceptor.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/auth/GroupAuthorizatedMethodInterceptor.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -1,89 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.platf.server.auth;
-
-import javax.persistence.NoResultException;
-
-import org.aopalliance.intercept.MethodInterceptor;
-import org.aopalliance.intercept.MethodInvocation;
-import org.ourproject.kune.platf.client.errors.AccessViolationException;
-import org.ourproject.kune.platf.server.UserSession;
-import org.ourproject.kune.platf.server.access.AccessRights;
-import org.ourproject.kune.platf.server.access.AccessRightsService;
-import org.ourproject.kune.platf.server.access.AccessType;
-import org.ourproject.kune.platf.server.domain.Group;
-import org.ourproject.kune.platf.server.domain.User;
-import org.ourproject.kune.platf.server.manager.GroupManager;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-
-public class GroupAuthorizatedMethodInterceptor implements MethodInterceptor {
-
-    @Inject
-    Provider<UserSession> userSessionProvider;
-    @Inject
-    Provider<GroupManager> groupManagerProvider;
-    @Inject
-    Provider<AccessRightsService> accessRightsServiceProvider;
-
-    public Object invoke(final MethodInvocation invocation) throws Throwable {
-	final Object[] arguments = invocation.getArguments();
-	final String groupShortName = (String) arguments[1];
-
-	final UserSession userSession = userSessionProvider.get();
-	final GroupManager groupManager = groupManagerProvider.get();
-
-	final GroupAuthorizated authoAnnotation = invocation.getStaticPart().getAnnotation(GroupAuthorizated.class);
-	final AccessType accessType = authoAnnotation.accessTypeRequired();
-
-	final User user = userSession.getUser();
-
-	Group group = Group.NO_GROUP;
-	try {
-	    group = groupManager.findByShortName(groupShortName);
-	} catch (final NoResultException e) {
-	    throw new AccessViolationException();
-	}
-
-	if (!correctMember(user, group, accessType)) {
-	    throw new AccessViolationException();
-	}
-
-	final Object result = invocation.proceed();
-	return result;
-    }
-
-    private boolean correctMember(final User user, final Group group, final AccessType memberType)
-	    throws AccessViolationException {
-	final AccessRightsService accessRightsService = accessRightsServiceProvider.get();
-	final AccessRights accessRights = accessRightsService.get(user, group.getSocialNetwork().getAccessLists());
-
-	switch (memberType) {
-	case ADMIN:
-	    return accessRights.isAdministrable();
-	case EDIT:
-	    return accessRights.isEditable();
-	default:
-	    return accessRights.isVisible();
-	}
-    }
-
-}

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/GroupManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/GroupManager.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/GroupManager.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -26,26 +26,27 @@
 import org.ourproject.kune.platf.client.errors.EmailAddressInUseException;
 import org.ourproject.kune.platf.client.errors.GroupNameInUseException;
 import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
+import org.ourproject.kune.platf.server.domain.Content;
 import org.ourproject.kune.platf.server.domain.Group;
 import org.ourproject.kune.platf.server.domain.User;
 import org.ourproject.kune.platf.server.manager.impl.SearchResult;
 
 public interface GroupManager extends Manager<Group, Long> {
 
-    Group findByShortName(String groupName);
+    void changeWsTheme(User user, Group group, String theme) throws AccessViolationException;
 
+    Group createGroup(Group group, User user) throws GroupNameInUseException, UserMustBeLoggedException;
+
+    Group createUserGroup(User user) throws GroupNameInUseException, EmailAddressInUseException;
+
     List<Group> findAdminInGroups(Long groupId);
 
+    Group findByShortName(String groupName);
+
     List<Group> findCollabInGroups(Long groupId);
 
-    Group createGroup(Group group, User user) throws GroupNameInUseException, UserMustBeLoggedException;
-
-    Group createUserGroup(User user) throws GroupNameInUseException, EmailAddressInUseException;
-
     Group getDefaultGroup();
 
-    void changeWsTheme(User user, Group group, String theme) throws AccessViolationException;
-
     /**
      * IMPORTANT: returns null if userId is null
      * 
@@ -54,10 +55,12 @@
      */
     Group getGroupOfUserWithId(Long userId);
 
+    void reIndex();
+
     SearchResult<Group> search(String search);
 
     SearchResult<Group> search(String search, Integer firstResult, Integer maxResults);
 
-    void reIndex();
+    void setDefaultContent(String groupShortName, Content content);
 
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -37,6 +37,7 @@
 import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
 import org.ourproject.kune.platf.server.domain.AccessLists;
 import org.ourproject.kune.platf.server.domain.AdmissionType;
+import org.ourproject.kune.platf.server.domain.Content;
 import org.ourproject.kune.platf.server.domain.Group;
 import org.ourproject.kune.platf.server.domain.GroupListMode;
 import org.ourproject.kune.platf.server.domain.License;
@@ -170,6 +171,11 @@
 	return super.search(query, firstResult, maxResults);
     }
 
+    public void setDefaultContent(final String groupShortName, final Content content) {
+	final Group group = findByShortName(groupShortName);
+	group.setDefaultContent(content);
+    }
+
     private void initGroup(final User user, final Group group) throws GroupNameInUseException {
 	try {
 	    persist(group);

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -44,8 +44,9 @@
 import org.ourproject.kune.platf.server.UserSession;
 import org.ourproject.kune.platf.server.access.Access;
 import org.ourproject.kune.platf.server.access.AccessRightsService;
+import org.ourproject.kune.platf.server.access.AccessRol;
 import org.ourproject.kune.platf.server.access.AccessService;
-import org.ourproject.kune.platf.server.access.AccessType;
+import org.ourproject.kune.platf.server.auth.ActionLevel;
 import org.ourproject.kune.platf.server.auth.Authenticated;
 import org.ourproject.kune.platf.server.auth.Authorizated;
 import org.ourproject.kune.platf.server.content.CommentManager;
@@ -109,75 +110,78 @@
     }
 
     @Authenticated
-    @Authorizated(accessTypeRequired = AccessType.EDIT, checkContent = true)
+    @Authorizated(accessRolRequired = AccessRol.Editor)
     @Transactional(type = TransactionType.READ_WRITE)
-    public void addAuthor(final String userHash, final String groupShortName, final String documentId,
-	    final String authorShortName) throws DefaultException {
-	final Long contentId = parseId(documentId);
+    public void addAuthor(final String userHash, final StateToken token, final String authorShortName)
+	    throws DefaultException {
+	final Long contentId = parseId(token.getDocument());
 	final UserSession userSession = getUserSession();
 	final User user = userSession.getUser();
 	contentManager.addAuthor(user, contentId, authorShortName);
     }
 
     @Authenticated
-    @Authorizated(accessTypeRequired = AccessType.READ)
+    @Authorizated(accessRolRequired = AccessRol.Viewer)
     @Transactional(type = TransactionType.READ_WRITE)
-    public CommentDTO addComment(final String userHash, final String groupShortName, final String documentId,
-	    final Long parentCommentId, final String commentText) throws DefaultException {
+    public CommentDTO addComment(final String userHash, final StateToken token, final Long parentCommentId,
+	    final String commentText) throws DefaultException {
 	final UserSession userSession = getUserSession();
 	final User author = userSession.getUser();
-	final Long contentId = parseId(documentId);
+	final Long contentId = parseId(token.getDocument());
 	final Comment comment = commentManager.addComment(author, contentId, commentText, parentCommentId);
 	return mapper.map(comment, CommentDTO.class);
     }
 
     @Authenticated
-    @Authorizated(accessTypeRequired = AccessType.READ)
+    @Authorizated(accessRolRequired = AccessRol.Viewer)
     @Transactional(type = TransactionType.READ_WRITE)
-    public CommentDTO addComment(final String userHash, final String groupShortName, final String documentId,
-	    final String commentText) throws DefaultException {
+    public CommentDTO addComment(final String userHash, final StateToken token, final String commentText)
+	    throws DefaultException {
 	final UserSession userSession = getUserSession();
 	final User author = userSession.getUser();
-	final Long contentId = parseId(documentId);
+	final Long contentId = parseId(token.getDocument());
 	final Comment comment = commentManager.addComment(author, contentId, commentText);
 	return mapper.map(comment, CommentDTO.class);
     }
 
     @Authenticated
-    @Authorizated(accessTypeRequired = AccessType.EDIT)
+    @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor)
     @Transactional(type = TransactionType.READ_WRITE)
-    public StateDTO addContent(final String userHash, final String groupShortName, final Long parentFolderId,
-	    final String title) throws DefaultException {
-	final Group group = groupManager.findByShortName(groupShortName);
+    public StateDTO addContent(final String userHash, final StateToken parentToken, final String title)
+	    throws DefaultException {
+	final Group group = groupManager.findByShortName(parentToken.getGroup());
 	final UserSession userSession = getUserSession();
 	final User user = userSession.getUser();
 	final boolean userIsLoggedIn = userSession.isUserLoggedIn();
-	final Access access = accessService.getFolderAccess(group, parentFolderId, user, AccessType.EDIT);
-	access.setContentWidthFolderRights(creationService.createContent(title, "", user, access.getFolder()));
+	final Container container = accessService.accessToContainer(parseId(parentToken.getFolder()), user,
+		AccessRol.Editor);
+	final Content addedContent = creationService.createContent(title, "", user, container);
+	final Access access = accessService.getAccess(user, addedContent.getStateToken(), group, AccessRol.Editor);
 	final State state = stateService.create(access);
 	completeState(user, userIsLoggedIn, group, state);
 	return mapState(state, user, group);
     }
 
     @Authenticated
-    @Authorizated(accessTypeRequired = AccessType.EDIT)
+    @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor)
     @Transactional(type = TransactionType.READ_WRITE)
-    public StateDTO addFolder(final String userHash, final String groupShortName, final Long parentFolderId,
-	    final String title, final String contentTypeId) throws DefaultException {
-	final Group group = groupManager.findByShortName(groupShortName);
+    public StateDTO addFolder(final String userHash, final StateToken parentToken, final String title,
+	    final String contentTypeId) throws DefaultException {
+	final Group group = groupManager.findByShortName(parentToken.getGroup());
 	final UserSession userSession = getUserSession();
 	final User user = userSession.getUser();
 	final boolean userIsLoggedIn = userSession.isUserLoggedIn();
-	final State state = createFolder(groupShortName, parentFolderId, title, contentTypeId);
+	final State state = createFolder(parentToken.getGroup(), parseId(parentToken.getFolder()), title, contentTypeId);
 	completeState(user, userIsLoggedIn, group, state);
 	return mapState(state, user, group);
     }
 
     @Authenticated
-    @Authorizated(accessTypeRequired = AccessType.EDIT)
+    @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor)
     @Transactional(type = TransactionType.READ_WRITE)
-    public StateDTO addRoom(final String userHash, final String groupShortName, final Long parentFolderId,
-	    final String roomName) throws DefaultException {
+    public StateDTO addRoom(final String userHash, final StateToken parentToken, final String roomName)
+	    throws DefaultException {
+	final String groupShortName = parentToken.getGroup();
 	final Group group = groupManager.findByShortName(groupShortName);
 	final UserSession userSession = getUserSession();
 	final User user = userSession.getUser();
@@ -188,7 +192,8 @@
 	xmppManager.createRoom(connection, roomName, userShortName + userHash);
 	xmppManager.disconnect(connection);
 	try {
-	    final State state = createFolder(groupShortName, parentFolderId, roomName, ChatServerTool.TYPE_ROOM);
+	    final State state = createFolder(groupShortName, parseId(parentToken.getFolder()), roomName,
+		    ChatServerTool.TYPE_ROOM);
 	    completeState(user, userIsLoggedIn, group, state);
 	    return mapState(state, user, group);
 	} catch (final ContentNotFoundException e) {
@@ -204,11 +209,10 @@
     }
 
     @Authenticated
-    @Authorizated(accessTypeRequired = AccessType.ADMIN, checkContent = true)
+    @Authorizated(accessRolRequired = AccessRol.Administrator)
     @Transactional(type = TransactionType.READ_WRITE)
-    public void delContent(final String userHash, final String groupShortName, final String documentId)
-	    throws DefaultException {
-	final Long contentId = parseId(documentId);
+    public void delContent(final String userHash, final StateToken token) throws DefaultException {
+	final Long contentId = parseId(token.getDocument());
 	final UserSession userSession = getUserSession();
 	final User user = userSession.getUser();
 	contentManager.delContent(user, contentId);
@@ -219,8 +223,7 @@
     // contents for instance)
     @Authenticated(mandatory = false)
     @Transactional(type = TransactionType.READ_ONLY)
-    public StateDTO getContent(final String userHash, final String groupShortName, final StateToken token)
-	    throws DefaultException {
+    public StateDTO getContent(final String userHash, final StateToken token) throws DefaultException {
 	Group defaultGroup;
 	final UserSession userSession = getUserSession();
 	final User user = userSession.getUser();
@@ -232,7 +235,7 @@
 	}
 	Access access;
 	try {
-	    access = accessService.getAccess(user, token, defaultGroup, AccessType.READ);
+	    access = accessService.getAccess(user, token, defaultGroup, AccessRol.Viewer);
 	} catch (final NoResultException e) {
 	    throw new ContentNotFoundException();
 	} catch (final ToolNotFoundException e) {
@@ -245,33 +248,32 @@
     }
 
     @Authenticated(mandatory = false)
-    @Authorizated(accessTypeRequired = AccessType.READ)
+    @Authorizated(accessRolRequired = AccessRol.Viewer)
     @Transactional(type = TransactionType.READ_ONLY)
-    public List<TagResultDTO> getSummaryTags(final String userHash, final String groupShortName) {
-	final Group group = groupManager.findByShortName(groupShortName);
+    public List<TagResultDTO> getSummaryTags(final String userHash, final StateToken groupToken) {
+	final Group group = groupManager.findByShortName(groupToken.getGroup());
 	return getSummaryTags(group);
     }
 
     @Authenticated
-    @Authorizated(accessTypeRequired = AccessType.READ)
+    @Authorizated(accessRolRequired = AccessRol.Viewer)
     @Transactional(type = TransactionType.READ_WRITE)
-    public CommentDTO markCommentAsAbuse(final String userHash, final String groupShortName, final String documentId,
-	    final Long commentId) throws DefaultException {
+    public CommentDTO markCommentAsAbuse(final String userHash, final StateToken token, final Long commentId)
+	    throws DefaultException {
 	final UserSession userSession = getUserSession();
 	final User informer = userSession.getUser();
-	final Long contentId = parseId(documentId);
+	final Long contentId = parseId(token.getDocument());
 	final Comment comment = commentManager.markAsAbuse(informer, contentId, commentId);
 	return mapper.map(comment, CommentDTO.class);
     }
 
     @Authenticated
-    @Authorizated(accessTypeRequired = AccessType.READ, checkContent = true)
+    @Authorizated(accessRolRequired = AccessRol.Viewer)
     @Transactional(type = TransactionType.READ_WRITE)
-    public void rateContent(final String userHash, final String groupShortName, final String documentId,
-	    final Double value) throws DefaultException {
+    public void rateContent(final String userHash, final StateToken token, final Double value) throws DefaultException {
 	final UserSession userSession = getUserSession();
 	final User rater = userSession.getUser();
-	final Long contentId = parseId(documentId);
+	final Long contentId = parseId(token.getDocument());
 
 	if (userSession.isUserLoggedIn()) {
 	    contentManager.rateContent(rater, contentId, value);
@@ -281,100 +283,105 @@
     }
 
     @Authenticated
-    @Authorizated(accessTypeRequired = AccessType.EDIT, checkContent = true)
+    @Authorizated(accessRolRequired = AccessRol.Editor)
     @Transactional(type = TransactionType.READ_WRITE)
-    public void removeAuthor(final String userHash, final String groupShortName, final String documentId,
-	    final String authorShortName) throws DefaultException {
-	final Long contentId = parseId(documentId);
+    public void removeAuthor(final String userHash, final StateToken token, final String authorShortName)
+	    throws DefaultException {
+	final Long contentId = parseId(token.getDocument());
 	final UserSession userSession = getUserSession();
 	final User user = userSession.getUser();
 	contentManager.removeAuthor(user, contentId, authorShortName);
     }
 
     @Authenticated
-    @Authorizated(accessTypeRequired = AccessType.EDIT)
+    @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor)
     @Transactional(type = TransactionType.READ_WRITE)
-    public String rename(final String userHash, final String groupShortName, final String token, final String newName)
+    public String renameContainer(final String userHash, final StateToken token, final String newName)
 	    throws DefaultException {
-	String result;
+	return renameFolder(token.getGroup(), parseId(token.getFolder()), newName);
+    }
+
+    @Authenticated
+    @Authorizated(accessRolRequired = AccessRol.Editor)
+    @Transactional(type = TransactionType.READ_WRITE)
+    public String renameContent(final String userHash, final StateToken token, final String newName)
+	    throws DefaultException {
 	final UserSession userSession = getUserSession();
 	final User user = userSession.getUser();
-	final StateToken stateToken = new StateToken(token);
-	final Group group = groupManager.findByShortName(groupShortName);
-	if (stateToken.isComplete()) {
-	    try {
-		final Content content = accessService.accessToContent(parseId(stateToken.getDocument()), user,
-			AccessType.EDIT);
-		if (!content.getContainer().getOwner().equals(group)) {
-		    throw new AccessViolationException();
-		}
-	    } catch (final NoResultException e) {
-		throw new AccessViolationException();
-	    }
-	    result = renameContent(stateToken.getDocument(), newName);
-	} else {
-	    result = renameFolder(groupShortName, parseId(stateToken.getFolder()), newName);
+	try {
+	    accessService.accessToContent(parseId(token.getDocument()), user, AccessRol.Editor);
+	} catch (final NoResultException e) {
+	    throw new AccessViolationException();
 	}
-	return result;
+	return renameContent(token.getDocument(), newName);
     }
 
     @Authenticated
-    @Authorizated(accessTypeRequired = AccessType.EDIT, checkContent = true)
+    @Authorizated(accessRolRequired = AccessRol.Editor)
     @Transactional(type = TransactionType.READ_WRITE)
-    public Integer save(final String userHash, final String groupShortName, final String documentId,
-	    final String textContent) throws DefaultException {
+    public Integer save(final String userHash, final StateToken token, final String textContent)
+	    throws DefaultException {
 
-	final Long contentId = parseId(documentId);
+	final Long contentId = parseId(token.getDocument());
 	final UserSession userSession = getUserSession();
 	final User user = userSession.getUser();
-	final Content content = accessService.accessToContent(contentId, user, AccessType.EDIT);
+	final Content content = accessService.accessToContent(contentId, user, AccessRol.Editor);
 	final Content descriptor = creationService.saveContent(user, content, textContent);
 	return descriptor.getVersion();
     }
 
     @Authenticated
-    @Authorizated(accessTypeRequired = AccessType.EDIT, checkContent = true)
+    @Authorizated(accessRolRequired = AccessRol.Administrator)
     @Transactional(type = TransactionType.READ_WRITE)
-    public I18nLanguageDTO setLanguage(final String userHash, final String groupShortName, final String documentId,
-	    final String languageCode) throws DefaultException {
-	final Long contentId = parseId(documentId);
+    public ContentDTO setAsDefaultContent(final String userHash, final StateToken token) {
+	final Content content = contentManager.find(parseId(token.getDocument()));
+	groupManager.setDefaultContent(token.getGroup(), content);
+	return mapper.map(content, ContentDTO.class);
+    }
+
+    @Authenticated
+    @Authorizated(accessRolRequired = AccessRol.Editor)
+    @Transactional(type = TransactionType.READ_WRITE)
+    public I18nLanguageDTO setLanguage(final String userHash, final StateToken token, final String languageCode)
+	    throws DefaultException {
+	final Long contentId = parseId(token.getDocument());
 	final UserSession userSession = getUserSession();
 	final User user = userSession.getUser();
 	return mapper.map(contentManager.setLanguage(user, contentId, languageCode), I18nLanguageDTO.class);
     }
 
     @Authenticated
-    @Authorizated(accessTypeRequired = AccessType.EDIT, checkContent = true)
+    @Authorizated(accessRolRequired = AccessRol.Editor)
     @Transactional(type = TransactionType.READ_WRITE)
-    public void setPublishedOn(final String userHash, final String groupShortName, final String documentId,
-	    final Date publishedOn) throws DefaultException {
-	final Long contentId = parseId(documentId);
+    public void setPublishedOn(final String userHash, final StateToken token, final Date publishedOn)
+	    throws DefaultException {
+	final Long contentId = parseId(token.getDocument());
 	final UserSession userSession = getUserSession();
 	final User user = userSession.getUser();
 	contentManager.setPublishedOn(user, contentId, publishedOn);
     }
 
     @Authenticated
-    @Authorizated(accessTypeRequired = AccessType.EDIT, checkContent = true)
+    @Authorizated(accessRolRequired = AccessRol.Editor)
     @Transactional(type = TransactionType.READ_WRITE)
-    public List<TagResultDTO> setTags(final String userHash, final String groupShortName, final String documentId,
-	    final String tags) throws DefaultException {
-	final Long contentId = parseId(documentId);
+    public List<TagResultDTO> setTags(final String userHash, final StateToken token, final String tags)
+	    throws DefaultException {
+	final Long contentId = parseId(token.getDocument());
 	final UserSession userSession = getUserSession();
 	final User user = userSession.getUser();
-	final Group group = groupManager.findByShortName(groupShortName);
+	final Group group = groupManager.findByShortName(token.getGroup());
 	contentManager.setTags(user, contentId, tags);
 	return getSummaryTags(group);
     }
 
     @Authenticated
-    @Authorizated(accessTypeRequired = AccessType.READ)
+    @Authorizated(accessRolRequired = AccessRol.Viewer)
     @Transactional(type = TransactionType.READ_WRITE)
-    public CommentDTO voteComment(final String userHash, final String groupShortName, final String documentId,
-	    final Long commentId, final boolean votePositive) throws DefaultException {
+    public CommentDTO voteComment(final String userHash, final StateToken token, final Long commentId,
+	    final boolean votePositive) throws DefaultException {
 	final UserSession userSession = getUserSession();
 	final User voter = userSession.getUser();
-	final Long contentId = parseId(documentId);
+	final Long contentId = parseId(token.getDocument());
 	final Comment comment = commentManager.vote(voter, contentId, commentId, votePositive);
 	return mapper.map(comment, CommentDTO.class);
     }
@@ -401,11 +408,11 @@
 	final User user = userSession.getUser();
 	final Group group = groupManager.findByShortName(groupShortName);
 
-	Access access = accessService.getFolderAccess(group, parentFolderId, user, AccessType.EDIT);
+	accessService.accessToContainer(parentFolderId, user, AccessRol.Editor);
 
 	final Container container = creationService.createFolder(group, parentFolderId, title, user.getLanguage(),
 		typeId);
-	access = accessService.getAccess(user, container.getStateToken(), group, AccessType.EDIT);
+	final Access access = accessService.getAccess(user, container.getStateToken(), group, AccessRol.Editor);
 	final State state = stateService.create(access);
 	return state;
     }
@@ -436,9 +443,9 @@
 	return stateDTO;
     }
 
-    private Long parseId(final String documentId) throws ContentNotFoundException {
+    private Long parseId(final String id) throws ContentNotFoundException {
 	try {
-	    return new Long(documentId);
+	    return new Long(id);
 	} catch (final NumberFormatException e) {
 	    throw new ContentNotFoundException();
 	}
@@ -457,7 +464,8 @@
 	final Group group = groupManager.findByShortName(groupShortName);
 	final UserSession userSession = getUserSession();
 	final User user = userSession.getUser();
-	final Access folderAccess = accessService.getFolderAccess(group, folderId, user, AccessType.EDIT);
-	return containerManager.renameFolder(group, folderAccess.getFolder(), newName);
+	final Container container = accessService.accessToContainer(folderId, user, AccessRol.Editor);
+	return containerManager.renameFolder(group, container, newName);
     }
+
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rpc/GroupRPC.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rpc/GroupRPC.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rpc/GroupRPC.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -27,9 +27,10 @@
 import org.ourproject.kune.platf.client.errors.DefaultException;
 import org.ourproject.kune.platf.client.rpc.GroupService;
 import org.ourproject.kune.platf.server.UserSession;
-import org.ourproject.kune.platf.server.access.AccessType;
+import org.ourproject.kune.platf.server.access.AccessRol;
+import org.ourproject.kune.platf.server.auth.ActionLevel;
 import org.ourproject.kune.platf.server.auth.Authenticated;
-import org.ourproject.kune.platf.server.auth.GroupAuthorizated;
+import org.ourproject.kune.platf.server.auth.Authorizated;
 import org.ourproject.kune.platf.server.content.ContentManager;
 import org.ourproject.kune.platf.server.domain.Group;
 import org.ourproject.kune.platf.server.domain.User;
@@ -60,13 +61,13 @@
     }
 
     @Authenticated
-    @GroupAuthorizated(accessTypeRequired = AccessType.ADMIN)
+    @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
     @Transactional(type = TransactionType.READ_WRITE, rollbackOn = DefaultException.class)
-    public void changeGroupWsTheme(final String userHash, final String groupShortName, final String theme)
+    public void changeGroupWsTheme(final String userHash, final StateToken groupToken, final String theme)
 	    throws DefaultException {
 	final UserSession userSession = getUserSession();
 	final User user = userSession.getUser();
-	final Group group = groupManager.findByShortName(groupShortName);
+	final Group group = groupManager.findByShortName(groupToken.getGroup());
 	groupManager.changeWsTheme(user, group, theme);
     }
 

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SocialNetworkRPC.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -23,12 +23,14 @@
 import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
 import org.ourproject.kune.platf.client.dto.SocialNetworkRequestResult;
 import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.errors.DefaultException;
 import org.ourproject.kune.platf.client.rpc.SocialNetworkService;
 import org.ourproject.kune.platf.server.UserSession;
-import org.ourproject.kune.platf.server.access.AccessType;
+import org.ourproject.kune.platf.server.access.AccessRol;
+import org.ourproject.kune.platf.server.auth.ActionLevel;
 import org.ourproject.kune.platf.server.auth.Authenticated;
-import org.ourproject.kune.platf.server.auth.GroupAuthorizated;
+import org.ourproject.kune.platf.server.auth.Authorizated;
 import org.ourproject.kune.platf.server.domain.Group;
 import org.ourproject.kune.platf.server.domain.User;
 import org.ourproject.kune.platf.server.manager.GroupManager;
@@ -59,78 +61,78 @@
     }
 
     @Authenticated
-    @GroupAuthorizated(accessTypeRequired = AccessType.ADMIN)
+    @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
     @Transactional(type = TransactionType.READ_WRITE)
-    public SocialNetworkResultDTO AcceptJoinGroup(final String hash, final String groupShortName,
+    public SocialNetworkResultDTO AcceptJoinGroup(final String hash, final StateToken groupToken,
 	    final String groupToAcceptShortName) throws DefaultException {
 	final UserSession userSession = getUserSession();
 	final User userLogged = userSession.getUser();
-	final Group group = groupManager.findByShortName(groupShortName);
+	final Group group = groupManager.findByShortName(groupToken.getGroup());
 	final Group groupToAccept = groupManager.findByShortName(groupToAcceptShortName);
 	socialNetworkManager.acceptJoinGroup(userLogged, groupToAccept, group);
 	return new SocialNetworkResultDTO(getGroupMembers(userLogged, group), getParticipation(userLogged, group));
     }
 
     @Authenticated
-    @GroupAuthorizated(accessTypeRequired = AccessType.ADMIN)
+    @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
     @Transactional(type = TransactionType.READ_WRITE)
-    public SocialNetworkResultDTO addAdminMember(final String hash, final String groupShortName,
+    public SocialNetworkResultDTO addAdminMember(final String hash, final StateToken groupToken,
 	    final String groupToAddShortName) throws DefaultException {
 	final UserSession userSession = getUserSession();
 	final User userLogged = userSession.getUser();
-	final Group group = groupManager.findByShortName(groupShortName);
+	final Group group = groupManager.findByShortName(groupToken.getGroup());
 	final Group groupToAdd = groupManager.findByShortName(groupToAddShortName);
 	socialNetworkManager.addGroupToAdmins(userLogged, groupToAdd, group);
 	return new SocialNetworkResultDTO(getGroupMembers(userLogged, group), getParticipation(userLogged, group));
     }
 
     @Authenticated
-    @GroupAuthorizated(accessTypeRequired = AccessType.ADMIN)
+    @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
     @Transactional(type = TransactionType.READ_WRITE)
-    public SocialNetworkResultDTO addCollabMember(final String hash, final String groupShortName,
+    public SocialNetworkResultDTO addCollabMember(final String hash, final StateToken groupToken,
 	    final String groupToAddShortName) throws DefaultException {
 	final UserSession userSession = getUserSession();
 	final User userLogged = userSession.getUser();
-	final Group group = groupManager.findByShortName(groupShortName);
+	final Group group = groupManager.findByShortName(groupToken.getGroup());
 	final Group groupToAdd = groupManager.findByShortName(groupToAddShortName);
 	socialNetworkManager.addGroupToCollabs(userLogged, groupToAdd, group);
 	return new SocialNetworkResultDTO(getGroupMembers(userLogged, group), getParticipation(userLogged, group));
     }
 
     @Authenticated
-    @GroupAuthorizated(accessTypeRequired = AccessType.ADMIN)
+    @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
     @Transactional(type = TransactionType.READ_WRITE)
-    public SocialNetworkResultDTO addViewerMember(final String hash, final String groupShortName,
+    public SocialNetworkResultDTO addViewerMember(final String hash, final StateToken groupToken,
 	    final String groupToAddShortName) throws DefaultException {
 	final UserSession userSession = getUserSession();
 	final User userLogged = userSession.getUser();
-	final Group group = groupManager.findByShortName(groupShortName);
+	final Group group = groupManager.findByShortName(groupToken.getGroup());
 	final Group groupToAdd = groupManager.findByShortName(groupToAddShortName);
 	socialNetworkManager.addGroupToViewers(userLogged, groupToAdd, group);
 	return new SocialNetworkResultDTO(getGroupMembers(userLogged, group), getParticipation(userLogged, group));
     }
 
     @Authenticated
-    @GroupAuthorizated(accessTypeRequired = AccessType.ADMIN)
+    @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
     @Transactional(type = TransactionType.READ_WRITE)
-    public SocialNetworkResultDTO deleteMember(final String hash, final String groupShortName,
+    public SocialNetworkResultDTO deleteMember(final String hash, final StateToken groupToken,
 	    final String groupToDeleleShortName) throws DefaultException {
 	final UserSession userSession = getUserSession();
 	final User userLogged = userSession.getUser();
-	final Group group = groupManager.findByShortName(groupShortName);
+	final Group group = groupManager.findByShortName(groupToken.getGroup());
 	final Group groupToDelete = groupManager.findByShortName(groupToDeleleShortName);
 	socialNetworkManager.deleteMember(userLogged, groupToDelete, group);
 	return new SocialNetworkResultDTO(getGroupMembers(userLogged, group), getParticipation(userLogged, group));
     }
 
     @Authenticated
-    @GroupAuthorizated(accessTypeRequired = AccessType.ADMIN)
+    @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
     @Transactional(type = TransactionType.READ_WRITE)
-    public SocialNetworkResultDTO denyJoinGroup(final String hash, final String groupShortName,
+    public SocialNetworkResultDTO denyJoinGroup(final String hash, final StateToken groupToken,
 	    final String groupToDenyShortName) throws DefaultException {
 	final UserSession userSession = getUserSession();
 	final User userLogged = userSession.getUser();
-	final Group group = groupManager.findByShortName(groupShortName);
+	final Group group = groupManager.findByShortName(groupToken.getGroup());
 	final Group groupToDenyJoin = groupManager.findByShortName(groupToDenyShortName);
 	socialNetworkManager.denyJoinGroup(userLogged, groupToDenyJoin, group);
 	return new SocialNetworkResultDTO(getGroupMembers(userLogged, group), getParticipation(userLogged, group));
@@ -138,58 +140,58 @@
 
     @Authenticated(mandatory = false)
     // At least you can access as Viewer to the Group
-    @GroupAuthorizated(accessTypeRequired = AccessType.READ)
+    @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Viewer)
     @Transactional(type = TransactionType.READ_ONLY)
-    public SocialNetworkDTO getGroupMembers(final String hash, final String groupShortName) throws DefaultException {
+    public SocialNetworkDTO getGroupMembers(final String hash, final StateToken groupToken) throws DefaultException {
 	final UserSession userSession = getUserSession();
 	final User user = userSession.getUser();
-	final Group group = groupManager.findByShortName(groupShortName);
+	final Group group = groupManager.findByShortName(groupToken.getGroup());
 	return getGroupMembers(user, group);
     }
 
     @Authenticated(mandatory = false)
     // At least you can access as Viewer to the Group
-    @GroupAuthorizated(accessTypeRequired = AccessType.READ)
+    @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Viewer)
     @Transactional(type = TransactionType.READ_ONLY)
-    public ParticipationDataDTO getParticipation(final String hash, final String groupShortName)
+    public ParticipationDataDTO getParticipation(final String hash, final StateToken groupToken)
 	    throws DefaultException {
 	final UserSession userSession = getUserSession();
 	final User user = userSession.getUser();
-	final Group group = groupManager.findByShortName(groupShortName);
+	final Group group = groupManager.findByShortName(groupToken.getGroup());
 	return getParticipation(user, group);
     }
 
     @Authenticated
     @Transactional(type = TransactionType.READ_WRITE)
-    public SocialNetworkRequestResult requestJoinGroup(final String hash, final String groupShortName)
+    public SocialNetworkRequestResult requestJoinGroup(final String hash, final StateToken groupToken)
 	    throws DefaultException {
 	final UserSession userSession = getUserSession();
 	final User user = userSession.getUser();
-	final Group group = groupManager.findByShortName(groupShortName);
+	final Group group = groupManager.findByShortName(groupToken.getGroup());
 	return socialNetworkManager.requestToJoin(user, group);
     }
 
     @Authenticated
-    @GroupAuthorizated(accessTypeRequired = AccessType.ADMIN)
+    @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
     @Transactional(type = TransactionType.READ_WRITE)
-    public SocialNetworkResultDTO setAdminAsCollab(final String hash, final String groupShortName,
+    public SocialNetworkResultDTO setAdminAsCollab(final String hash, final StateToken groupToken,
 	    final String groupToSetCollabShortName) throws DefaultException {
 	final UserSession userSession = getUserSession();
 	final User userLogged = userSession.getUser();
-	final Group group = groupManager.findByShortName(groupShortName);
+	final Group group = groupManager.findByShortName(groupToken.getGroup());
 	final Group groupToSetCollab = groupManager.findByShortName(groupToSetCollabShortName);
 	socialNetworkManager.setAdminAsCollab(userLogged, groupToSetCollab, group);
 	return new SocialNetworkResultDTO(getGroupMembers(userLogged, group), getParticipation(userLogged, group));
     }
 
     @Authenticated
-    @GroupAuthorizated(accessTypeRequired = AccessType.ADMIN)
+    @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
     @Transactional(type = TransactionType.READ_WRITE)
-    public SocialNetworkResultDTO setCollabAsAdmin(final String hash, final String groupShortName,
+    public SocialNetworkResultDTO setCollabAsAdmin(final String hash, final StateToken groupToken,
 	    final String groupToSetAdminShortName) throws DefaultException {
 	final UserSession userSession = getUserSession();
 	final User userLogged = userSession.getUser();
-	final Group group = groupManager.findByShortName(groupShortName);
+	final Group group = groupManager.findByShortName(groupToken.getGroup());
 	final Group groupToSetAdmin = groupManager.findByShortName(groupToSetAdminShortName);
 	socialNetworkManager.setCollabAsAdmin(userLogged, groupToSetAdmin, group);
 	return new SocialNetworkResultDTO(getGroupMembers(userLogged, group), getParticipation(userLogged, group));
@@ -197,10 +199,10 @@
 
     @Authenticated
     @Transactional(type = TransactionType.READ_WRITE)
-    public SocialNetworkResultDTO unJoinGroup(final String hash, final String groupShortName) throws DefaultException {
+    public SocialNetworkResultDTO unJoinGroup(final String hash, final StateToken groupToken) throws DefaultException {
 	final UserSession userSession = getUserSession();
 	final User userLogged = userSession.getUser();
-	final Group group = groupManager.findByShortName(groupShortName);
+	final Group group = groupManager.findByShortName(groupToken.getGroup());
 	socialNetworkManager.unJoinGroup(userLogged.getUserGroup(), group);
 	return new SocialNetworkResultDTO(getGroupMembers(userLogged, group), getParticipation(userLogged, group));
     }

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/state/StateServiceDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/state/StateServiceDefault.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/state/StateServiceDefault.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -33,7 +33,7 @@
 
     public State create(final Access access) {
 	final Content content = access.getContent();
-	final Container container = content.getContainer();
+	final Container container = access.getContainer();
 	final State state = new State();
 
 	final Long documentId = content.getId();
@@ -72,7 +72,7 @@
 	state.setContainer(container);
 	state.setAccessLists(access.getContentAccessLists());
 	state.setContentRights(access.getContentRights());
-	state.setContainerRights(access.getFolderRights());
+	state.setContainerRights(access.getContainerRights());
 	state.setGroupRights(access.getGroupRights());
 	License contentLicense = content.getLicense();
 	if (contentLicense == null) {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigator.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigator.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigator.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -33,6 +33,8 @@
 
     View getView();
 
+    boolean isSelected(StateToken stateToken);
+
     void registerContentTypeIcon(String contentTypeId, String iconUrl);
 
     void registerDraggableType(String typeId);
@@ -43,6 +45,8 @@
 
     void selectItem(StateToken stateToken);
 
+    void setEditOnNextStateChange(boolean edit);
+
     void setItemText(StateToken stateToken, String name);
 
     void setState(StateDTO state);

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -20,36 +20,26 @@
 
 package org.ourproject.kune.workspace.client.ctxnav;
 
-import java.util.ArrayList;
 import java.util.HashMap;
 
-import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
-import org.ourproject.kune.platf.client.actions.ActionButtonSeparator;
 import org.ourproject.kune.platf.client.actions.ActionCollection;
 import org.ourproject.kune.platf.client.actions.ActionDescriptor;
-import org.ourproject.kune.platf.client.actions.ActionMenuDescriptor;
-import org.ourproject.kune.platf.client.actions.ActionPosition;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.services.I18nTranslationService;
-import org.ourproject.kune.workspace.client.skel.Toolbar;
+import org.ourproject.kune.workspace.client.site.Site;
 import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
 
 import com.allen_sauer.gwt.log.client.Log;
 import com.google.gwt.user.client.Command;
 import com.google.gwt.user.client.DeferredCommand;
-import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.ScrollPanel;
 import com.gwtext.client.core.EventObject;
 import com.gwtext.client.data.Node;
-import com.gwtext.client.widgets.Button;
-import com.gwtext.client.widgets.Panel;
-import com.gwtext.client.widgets.ToolbarButton;
-import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+import com.gwtext.client.data.Tree;
 import com.gwtext.client.widgets.form.TextField;
-import com.gwtext.client.widgets.layout.FitLayout;
 import com.gwtext.client.widgets.menu.BaseItem;
 import com.gwtext.client.widgets.menu.Item;
 import com.gwtext.client.widgets.menu.Menu;
-import com.gwtext.client.widgets.menu.MenuItem;
 import com.gwtext.client.widgets.menu.event.BaseItemListenerAdapter;
 import com.gwtext.client.widgets.tree.TreeEditor;
 import com.gwtext.client.widgets.tree.TreeNode;
@@ -62,11 +52,9 @@
     private TreePanel treePanel;
     private TreeEditor treeEditor;
     private final HashMap<String, Menu> contextMenus;
-    private final HashMap<String, Menu> toolbarMenus;
     private final WorkspaceSkeleton ws;
+    private boolean fireOnTextChange;
     private final ContextNavigatorPresenter presenter;
-    private final ArrayList<Widget> removableToolbarItems;
-    private final HashMap<String, Item> menuItems;
 
     public ContextNavigatorPanel(final ContextNavigatorPresenter presenter, final I18nTranslationService i18n,
 	    final WorkspaceSkeleton ws) {
@@ -74,38 +62,9 @@
 	this.ws = ws;
 
 	contextMenus = new HashMap<String, Menu>();
-	toolbarMenus = new HashMap<String, Menu>();
-	removableToolbarItems = new ArrayList<Widget>();
-	menuItems = new HashMap<String, Item>();
+	fireOnTextChange = true;
     }
 
-    public void addButtonAction(final ActionButtonDescriptor<StateToken> action) {
-	final ActionPosition pos = action.getActionPosition();
-	final ToolbarButton button = new ToolbarButton();
-	final String text = action.getText();
-	if (text != null) {
-	    button.setText(text);
-	}
-	button.addListener(new ButtonListenerAdapter() {
-	    @Override
-	    public void onClick(final Button button, final EventObject e) {
-		doAction(action, presenter.getCurrentStateToken());
-	    }
-	});
-	button.setIcon(action.getIconUrl());
-	button.setTooltip(action.getToolTip());
-
-	final Toolbar toolbar = getToolbar(pos);
-	if (action.hasLeftSeparator()) {
-	    removableToolbarItems.add(add(toolbar, action.getLeftSeparator()));
-	}
-	toolbar.add(button);
-	if (action.hasRightSeparator()) {
-	    removableToolbarItems.add(add(toolbar, action.getRightSeparator()));
-	}
-	removableToolbarItems.add(button);
-    }
-
     public void addItem(final ContextNavigatorItem item) {
 	final String nodeId = item.getId();
 	if (treePanel.getNodeById(nodeId) == null) {
@@ -138,7 +97,9 @@
 		child.addListener(new TreeNodeListenerAdapter() {
 		    @Override
 		    public void onTextChange(final Node node, final String text, final String oldText) {
-			presenter.onItemRename(getToken(node), text, oldText);
+			if (fireOnTextChange) {
+			    presenter.onItemRename(getToken(node), text, oldText);
+			}
 		    }
 		});
 		if (!item.getStateToken().hasAll()) {
@@ -164,57 +125,26 @@
 
     }
 
-    public void addMenuAction(final ActionMenuDescriptor<StateToken> action, final boolean enable) {
-	final String menuTitle = action.getParentMenuTitle();
-	final String menuSubTitle = action.getParentSubMenuTitle();
-	final ActionPosition pos = action.getActionPosition();
-	final String itemKey = genMenuKey(pos, menuTitle, menuSubTitle, action.getText());
-	Item item = menuItems.get(itemKey);
-	if (item == null) {
-	    item = createToolbarMenu(pos, menuTitle, menuSubTitle, action);
-	    menuItems.put(itemKey, item);
-	} else {
-	}
-	if (enable) { // && action.getEnableCondition().mustBeEnabled(param))
-	    // ) {
-	    item.enable();
-	} else {
-	    item.disable();
-	}
-	doLayoutIfNeeded(pos);
-    }
-
     public void clear() {
 	if (treePanel != null) {
 	    treePanel.clear();
+	    treePanel = null;
 	}
-	ws.getEntityWorkspace().getContextTopBar().removeAll();
-	ws.getEntityWorkspace().getContextBottomBar().removeAll();
 	contextMenus.clear();
-	toolbarMenus.clear();
-	menuItems.clear();
-	removableToolbarItems.clear();
     }
 
-    public void clearRemovableActions() {
-	for (final Widget widget : removableToolbarItems) {
-	    widget.removeFromParent();
-	}
-	removableToolbarItems.clear();
-	doLayoutIfNeeded();
+    public void editItem(final String id) {
+	treeEditor.startEdit(getNode(id));
     }
 
-    public void disableAllMenuItems() {
-	for (final Item item : menuItems.values()) {
-	    item.disable();
+    public boolean isSelected(final String id) {
+	final TreeNode item = getNode(id);
+	if (item != null) {
+	    return item.isSelected();
 	}
-	doLayoutIfNeeded();
+	return false;
     }
 
-    public void editItem(final String id) {
-	treeEditor.startEdit(getNode(id));
-    }
-
     public void selectItem(final String id) {
 	final TreeNode item = getNode(id);
 	if (item != null) {
@@ -230,6 +160,10 @@
 	}
     }
 
+    public void setFireOnTextChange(final boolean fireOnTextChange) {
+	this.fireOnTextChange = fireOnTextChange;
+    }
+
     public void setItemText(final String genId, final String text) {
 	final TreeNode node = getNode(genId);
 	node.setText(text);
@@ -242,22 +176,6 @@
 	}
     }
 
-    private void add(final ActionPosition toolbar, final Widget widget) {
-	getToolbar(toolbar).add(widget);
-    }
-
-    private Widget add(final Toolbar toolbar, final ActionButtonSeparator separator) {
-	switch (separator) {
-	case fill:
-	    return toolbar.addFill();
-	case separator:
-	    return toolbar.addSeparator();
-	case spacer:
-	default:
-	    return toolbar.addSpacer();
-	}
-    }
-
     private void createItemMenu(final String nodeId, final ActionCollection<StateToken> actionCollection,
 	    final StateToken stateToken) {
 	DeferredCommand.addCommand(new Command() {
@@ -286,61 +204,6 @@
 	});
     }
 
-    private Item createToolbarMenu(final ActionPosition toolBarPos, final String menuTitle, final String menuSubTitle,
-	    final ActionMenuDescriptor<StateToken> action) {
-	final Item item = new Item(action.getText(), new BaseItemListenerAdapter() {
-	    @Override
-	    public void onClick(BaseItem item, EventObject e) {
-		doAction(action, presenter.getCurrentStateToken());
-	    }
-	});
-	item.setIcon(action.getIconUrl());
-
-	final String menuKey = genMenuKey(toolBarPos, menuTitle, null, null);
-	final String subMenuKey = genMenuKey(toolBarPos, menuTitle, menuSubTitle, null);
-	Menu menu = toolbarMenus.get(menuKey);
-	Menu subMenu = toolbarMenus.get(subMenuKey);
-	if (menuSubTitle != null) {
-	    if (subMenu == null) {
-		subMenu = new Menu();
-		final MenuItem subMenuItem = new MenuItem(menuSubTitle, subMenu);
-		if (menu == null) {
-		    menu = createToolbarMenu(toolBarPos, action.getParentMenuIconUrl(), menuTitle, menuKey);
-		}
-		menu.addItem(subMenuItem);
-		toolbarMenus.put(subMenuKey, subMenu);
-	    }
-	    subMenu.addItem(item);
-
-	} else {
-	    // Menu action without submenu
-	    if (menu == null) {
-		menu = createToolbarMenu(toolBarPos, action.getParentMenuIconUrl(), menuTitle, menuKey);
-	    }
-	    menu.addItem(item);
-	}
-	doLayoutIfNeeded(toolBarPos);
-	return item;
-    }
-
-    private Menu createToolbarMenu(final ActionPosition barPosition, final String iconUrl, final String menuTitle,
-	    final String menuKey) {
-	final Menu menu = new Menu();
-	final ToolbarButton toolbarMenu = new ToolbarButton(menuTitle);
-	if (iconUrl != null) {
-	    toolbarMenu.setIcon(iconUrl);
-	}
-	toolbarMenu.addListener(new ButtonListenerAdapter() {
-	    @Override
-	    public void onClick(final Button button, final EventObject e) {
-		menu.showAt(e.getXY());
-	    }
-	});
-	toolbarMenus.put(menuKey, menu);
-	add(barPosition, toolbarMenu);
-	return menu;
-    }
-
     private void createTreePanel(final String rootId, final String text, final StateToken stateToken,
 	    final ActionCollection<StateToken> actions) {
 	if (treePanel != null) {
@@ -351,6 +214,7 @@
 	treePanel.setBorder(false);
 	treePanel.setRootVisible(true);
 	treePanel.setUseArrows(true);
+	// treePanel.setSelectionModel(new MultiSelectionModel());
 	final TreeNode root = new TreeNode();
 	root.setAllowDrag(false);
 	root.setExpanded(true);
@@ -362,48 +226,48 @@
 	treePanel.addListener(new TreePanelListenerAdapter() {
 	    public void onContextMenu(final TreeNode node, final EventObject e) {
 		final Menu menu = contextMenus.get(node.getId());
-		if (menu != null && menu.getItems().length != 0) {
+		if (menu != null && menu.getItems().length > 0) {
 		    menu.showAt(e.getXY());
 		} else {
 		    Log.info("Empty item menu");
 		}
 	    }
+
+	    @Override
+	    public void onMoveNode(final Tree treePanel, final TreeNode node, final TreeNode oldParent,
+		    final TreeNode newParent, final int index) {
+		newParent.removeChild(node);
+		oldParent.appendChild(node);
+		Site.info("Drag & drop of contents in development");
+	    }
 	});
 	treePanel.setLines(false);
 	treePanel.setEnableDD(true);
 	treePanel.setRootNode(root);
+	// treePanel.setAutoScroll(true);
+	treePanel.setContainerScroll(true);
+	treePanel.setAutoWidth(true);
+
 	final TextField field = new TextField();
 	treeEditor = new TreeEditor(treePanel, field);
-	final Panel panel = new Panel();
-	panel.setLayout(new FitLayout());
-	panel.setBorder(false);
-	panel.setAutoScroll(true);
+
+	final ScrollPanel panel = new ScrollPanel();
+	// final Panel panel = new Panel();
+	// panel.setLayout(new FitLayout());
+	// panel.setBorder(false);
+	// panel.setAutoScroll(true);
+	// new ScrollPanel
+	panel.setWidth("100%");
+	panel.setHeight("100%");
 	panel.add(treePanel);
 
-	ws.getEntityWorkspace().setContext(treePanel);
+	ws.getEntityWorkspace().setContext(panel);
     }
 
     private void doAction(final ActionDescriptor<StateToken> action, final StateToken stateToken) {
 	presenter.doAction(action, stateToken);
     }
 
-    private void doLayoutIfNeeded() {
-	doLayoutIfNeeded(ActionPosition.topbar);
-	doLayoutIfNeeded(ActionPosition.bottombar);
-    }
-
-    private void doLayoutIfNeeded(final ActionPosition pos) {
-	getToolbar(pos).doLayoutIfNeeded();
-    }
-
-    private String genMenuKey(final ActionPosition pos, final String menuTitle, final String menuSubTitle,
-	    final String actionText) {
-	final String basePart = "km-" + pos.toString() + "-" + menuTitle;
-	final String subMenuPart = menuSubTitle != null ? "-subm-" + menuSubTitle : "";
-	final String itemPart = actionText != null ? "-item-" + actionText : "";
-	return basePart + subMenuPart + itemPart;
-    }
-
     private TreeNode getNode(final String id) {
 	final TreeNode node = treePanel.getNodeById(id);
 	if (node == null) {
@@ -416,15 +280,4 @@
 	return node.getAttribute("href").substring(1);
     }
 
-    private Toolbar getToolbar(final ActionPosition pos) {
-	switch (pos) {
-	case bootombarAndItemMenu:
-	case bottombar:
-	    return ws.getEntityWorkspace().getContextBottomBar();
-	case topbar:
-	case topbarAndItemMenu:
-	default:
-	    return ws.getEntityWorkspace().getContextTopBar();
-	}
-    }
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -28,6 +28,7 @@
 import org.ourproject.kune.platf.client.actions.ActionCollection;
 import org.ourproject.kune.platf.client.actions.ActionCollectionSet;
 import org.ourproject.kune.platf.client.actions.ActionDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionEnableCondition;
 import org.ourproject.kune.platf.client.actions.ActionManager;
 import org.ourproject.kune.platf.client.actions.ActionMenuDescriptor;
 import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
@@ -48,7 +49,6 @@
 import com.calclab.suco.client.provider.Provider;
 import com.calclab.suco.client.signal.Slot;
 import com.calclab.suco.client.signal.Slot0;
-import com.calclab.suco.client.signal.Slot2;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
 public class ContextNavigatorPresenter implements ContextNavigator {
@@ -65,21 +65,26 @@
     private final HashMap<String, String> contentTypesIcons;
     private final EntityTitle entityTitle;
     private final Provider<ActionManager> actionManagerProvider;
+    private boolean editOnNextStateChange;
+    private final ContextNavigatorToolbar toolbar;
 
     public ContextNavigatorPresenter(final StateManager stateManager, final Session session,
 	    final Provider<ContentServiceAsync> contentServiceProvider, final I18nUITranslationService i18n,
-	    final EntityTitle entityTitle, final Provider<ActionManager> actionManagerProvider) {
+	    final EntityTitle entityTitle, final Provider<ActionManager> actionManagerProvider,
+	    final ContextNavigatorToolbar contextNavigatorToolbar) {
 	this.stateManager = stateManager;
 	this.session = session;
 	this.contentServiceProvider = contentServiceProvider;
 	this.i18n = i18n;
 	this.entityTitle = entityTitle;
 	this.actionManagerProvider = actionManagerProvider;
+	this.toolbar = contextNavigatorToolbar;
 	actions = new HashMap<String, ActionCollection<StateToken>>();
 	actionsByItem = new HashMap<StateToken, ActionCollection<StateToken>>();
 	draggables = new ArrayList<String>();
 	droppables = new ArrayList<String>();
 	contentTypesIcons = new HashMap<String, String>();
+	editOnNextStateChange = false;
     }
 
     public void addAction(final String contentTypeId, final ActionDescriptor<StateToken> action) {
@@ -113,20 +118,6 @@
 
     public void init(final ContextNavigatorView view) {
 	this.view = view;
-	stateManager.onGroupChanged(new Slot2<String, String>() {
-	    public void onEvent(final String oldGroup, final String newGroup) {
-		if (oldGroup != null) {
-		    clear();
-		}
-	    }
-	});
-	stateManager.onToolChanged(new Slot2<String, String>() {
-	    public void onEvent(final String oldTool, final String newTool) {
-		if (oldTool != null) {
-		    clear();
-		}
-	    }
-	});
 	session.onUserSignIn(new Slot<UserInfoDTO>() {
 	    public void onEvent(final UserInfoDTO parameter) {
 		clear();
@@ -139,26 +130,40 @@
 	});
     }
 
+    public boolean isSelected(final StateToken stateToken) {
+	return view.isSelected(genId(stateToken));
+    }
+
+    public boolean mustEditOnNextStateChange() {
+	return editOnNextStateChange;
+    }
+
     public void onItemRename(final String token, final String newName, final String oldName) {
 	if (!newName.equals(oldName)) {
 	    Site.showProgress(i18n.t("Renaming"));
-	    final StateDTO currentState = session.getCurrentState();
-	    contentServiceProvider.get().rename(session.getUserHash(), currentState.getGroup().getShortName(), token,
-		    newName, new AsyncCallback<String>() {
-			public void onFailure(final Throwable caught) {
-			    setItemText(new StateToken(token), oldName);
-			    Site.error(i18n.t("Error renaming"));
-			    Site.hideProgress();
-			}
+	    final StateToken stateToken = new StateToken(token);
+	    final AsyncCallback<String> asyncCallback = new AsyncCallback<String>() {
+		public void onFailure(final Throwable caught) {
+		    view.setFireOnTextChange(false);
+		    setItemText(stateToken, oldName);
+		    view.setFireOnTextChange(true);
+		    Site.error(i18n.t("Error renaming"));
+		    Site.hideProgress();
+		}
 
-			public void onSuccess(final String result) {
-			    Site.hideProgress();
-			    if (session.getCurrentState().getStateToken().getEncoded().equals(token)) {
-				// I have to update EntityTitle
-				entityTitle.setContentTitle(newName);
-			    }
-			}
-		    });
+		public void onSuccess(final String result) {
+		    Site.hideProgress();
+		    if (session.getCurrentState().getStateToken().getEncoded().equals(token)) {
+			// I have to update EntityTitle
+			entityTitle.setContentTitle(newName);
+		    }
+		}
+	    };
+	    if (stateToken.isComplete()) {
+		contentServiceProvider.get().renameContent(session.getUserHash(), stateToken, newName, asyncCallback);
+	    } else {
+		contentServiceProvider.get().renameContainer(session.getUserHash(), stateToken, newName, asyncCallback);
+	    }
 	}
     }
 
@@ -180,11 +185,15 @@
 
     public void selectItem(final StateToken stateToken) {
 	view.selectItem(genId(stateToken));
-	view.clearRemovableActions();
-	view.disableAllMenuItems();
+	toolbar.clearRemovableActions();
+	toolbar.disableAllMenuItems();
 	setActions(actionsByItem.get(stateToken), true);
     }
 
+    public void setEditOnNextStateChange(final boolean edit) {
+	editOnNextStateChange = edit;
+    }
+
     public void setItemText(final StateToken stateToken, final String name) {
 	view.setItemText(genId(stateToken), name);
     }
@@ -224,7 +233,13 @@
 	createChildItems(container, containerRights);
 
 	// Finaly
-	selectItem(stateToken);
+	if (mustEditOnNextStateChange()) {
+	    selectItem(stateToken);
+	    editItem(stateToken);
+	    setEditOnNextStateChange(false);
+	} else {
+	    selectItem(stateToken);
+	}
     }
 
     private void addItem(final String title, final String contentTypeId, final ContentStatusDTO status,
@@ -241,9 +256,17 @@
 	actionsByItem.put(stateToken, set.getToolbarActions());
     }
 
+    private boolean checkEnabling(final boolean isNodeSelected, final ActionDescriptor<StateToken> action) {
+	final ActionEnableCondition<StateToken> enableCondition = action.getEnableCondition();
+	final boolean mustBeEnabled = enableCondition != null ? enableCondition.mustBeEnabled(getCurrentStateToken())
+		: true;
+	return isNodeSelected && mustBeEnabled;
+    }
+
     private void clear() {
 	view.clear();
 	actionsByItem.clear();
+	toolbar.clear();
     }
 
     private void createChildItems(final ContainerDTO container, final AccessRightsDTO containerRights) {
@@ -332,10 +355,10 @@
     private void setActions(final ActionCollection<StateToken> actions, final boolean isNodeSelected) {
 	for (final ActionDescriptor<StateToken> action : actions) {
 	    if (action instanceof ActionMenuDescriptor) {
-		view.addMenuAction((ActionMenuDescriptor<StateToken>) action, isNodeSelected);
+		toolbar.addMenuAction((ActionMenuDescriptor<StateToken>) action, checkEnabling(isNodeSelected, action));
 	    } else {
-		if (isNodeSelected) {
-		    view.addButtonAction((ActionButtonDescriptor<StateToken>) action);
+		if (checkEnabling(isNodeSelected, action)) {
+		    toolbar.addButtonAction((ActionButtonDescriptor<StateToken>) action);
 		}
 	    }
 	}

Added: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorToolbar.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorToolbar.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorToolbar.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -0,0 +1,14 @@
+package org.ourproject.kune.workspace.client.ctxnav;
+
+import org.ourproject.kune.platf.client.actions.ActionManager;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+
+import com.calclab.suco.client.provider.Provider;
+
+public class ContextNavigatorToolbar extends EntityToolbar {
+    public ContextNavigatorToolbar(final Session session, final Provider<ActionManager> actionManagerProvider,
+	    final WorkspaceSkeleton ws) {
+	super(ToolbarPosition.context, session, actionManagerProvider, ws);
+    }
+}

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorView.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorView.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -21,29 +21,23 @@
 package org.ourproject.kune.workspace.client.ctxnav;
 
 import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
 import org.ourproject.kune.platf.client.actions.ActionCollection;
-import org.ourproject.kune.platf.client.actions.ActionMenuDescriptor;
 import org.ourproject.kune.platf.client.dto.StateToken;
 
 public interface ContextNavigatorView extends View {
 
-    void addButtonAction(ActionButtonDescriptor<StateToken> action);
-
     void addItem(ContextNavigatorItem contextNavigatorItem);
 
-    void addMenuAction(ActionMenuDescriptor<StateToken> action, boolean enable);
-
     void clear();
 
-    void disableAllMenuItems();
-
     void editItem(String id);
 
-    void clearRemovableActions();
+    boolean isSelected(String id);
 
     void selectItem(String id);
 
+    void setFireOnTextChange(boolean fire);
+
     void setItemText(String id, String text);
 
     void setRootItem(String id, String text, StateToken stateToken, ActionCollection<StateToken> actions);

Added: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/EntityToolbar.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/EntityToolbar.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/EntityToolbar.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -0,0 +1,233 @@
+package org.ourproject.kune.workspace.client.ctxnav;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionButtonSeparator;
+import org.ourproject.kune.platf.client.actions.ActionManager;
+import org.ourproject.kune.platf.client.actions.ActionMenuDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionPosition;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.workspace.client.skel.Toolbar;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+
+import com.calclab.suco.client.provider.Provider;
+import com.google.gwt.user.client.ui.Widget;
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.widgets.Button;
+import com.gwtext.client.widgets.ToolbarButton;
+import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+import com.gwtext.client.widgets.menu.BaseItem;
+import com.gwtext.client.widgets.menu.Item;
+import com.gwtext.client.widgets.menu.Menu;
+import com.gwtext.client.widgets.menu.MenuItem;
+import com.gwtext.client.widgets.menu.event.BaseItemListenerAdapter;
+
+public class EntityToolbar implements EntityToolbarView {
+
+    protected enum ToolbarPosition {
+	content, context
+    }
+
+    private final HashMap<String, Menu> toolbarMenus;
+    private final ArrayList<Widget> removableToolbarItems;
+    private final HashMap<String, Item> menuItems;
+    private final WorkspaceSkeleton ws;
+    private final Session session;
+    private final Provider<ActionManager> actionManagerProvider;
+    private final ToolbarPosition position;
+
+    public EntityToolbar(final ToolbarPosition position, final Session session,
+	    final Provider<ActionManager> actionManagerProvider, final WorkspaceSkeleton ws) {
+	this.position = position;
+	this.session = session;
+	this.actionManagerProvider = actionManagerProvider;
+	this.ws = ws;
+	toolbarMenus = new HashMap<String, Menu>();
+	removableToolbarItems = new ArrayList<Widget>();
+	menuItems = new HashMap<String, Item>();
+
+    }
+
+    public void addButtonAction(final ActionButtonDescriptor<StateToken> action) {
+	final ActionPosition pos = action.getActionPosition();
+	final ToolbarButton button = new ToolbarButton();
+	final String text = action.getText();
+	if (text != null) {
+	    button.setText(text);
+	}
+	button.addListener(new ButtonListenerAdapter() {
+	    @Override
+	    public void onClick(final Button button, final EventObject e) {
+		actionManagerProvider.get().doAction(action, session.getCurrentState().getStateToken());
+	    }
+	});
+	button.setIcon(action.getIconUrl());
+	button.setTooltip(action.getToolTip());
+
+	final Toolbar toolbar = getToolbar(pos);
+	if (action.hasLeftSeparator()) {
+	    removableToolbarItems.add(add(toolbar, action.getLeftSeparator()));
+	}
+	toolbar.add(button);
+	if (action.hasRightSeparator()) {
+	    removableToolbarItems.add(add(toolbar, action.getRightSeparator()));
+	}
+	removableToolbarItems.add(button);
+    }
+
+    public void addMenuAction(final ActionMenuDescriptor<StateToken> action, final boolean enable) {
+	final String menuTitle = action.getParentMenuTitle();
+	final String menuSubTitle = action.getParentSubMenuTitle();
+	final ActionPosition pos = action.getActionPosition();
+	final String itemKey = genMenuKey(pos, menuTitle, menuSubTitle, action.getText());
+	Item item = menuItems.get(itemKey);
+	if (item == null) {
+	    item = createToolbarMenu(pos, menuTitle, menuSubTitle, action);
+	    menuItems.put(itemKey, item);
+	}
+	if (enable) {
+	    item.enable();
+	} else {
+	    item.disable();
+	}
+	doLayoutIfNeeded(pos);
+    }
+
+    public void clear() {
+	toolbarMenus.clear();
+	menuItems.clear();
+	removableToolbarItems.clear();
+	getToolbar(ActionPosition.topbar).removeAll();
+	getToolbar(ActionPosition.bottombar).removeAll();
+    }
+
+    public void clearRemovableActions() {
+	for (final Widget widget : removableToolbarItems) {
+	    widget.removeFromParent();
+	}
+	removableToolbarItems.clear();
+	doLayoutIfNeeded();
+    }
+
+    public void disableAllMenuItems() {
+	for (final Item item : menuItems.values()) {
+	    item.disable();
+	}
+	doLayoutIfNeeded();
+    }
+
+    private void add(final ActionPosition toolbar, final Widget widget) {
+	getToolbar(toolbar).add(widget);
+    }
+
+    private Widget add(final Toolbar toolbar, final ActionButtonSeparator separator) {
+	switch (separator) {
+	case fill:
+	    return toolbar.addFill();
+	case separator:
+	    return toolbar.addSeparator();
+	case spacer:
+	default:
+	    return toolbar.addSpacer();
+	}
+    }
+
+    private Item createToolbarMenu(final ActionPosition toolBarPos, final String menuTitle, final String menuSubTitle,
+	    final ActionMenuDescriptor<StateToken> action) {
+	final Item item = new Item(action.getText(), new BaseItemListenerAdapter() {
+	    @Override
+	    public void onClick(BaseItem item, EventObject e) {
+		actionManagerProvider.get().doAction(action, session.getCurrentState().getStateToken());
+	    }
+	});
+	item.setIcon(action.getIconUrl());
+
+	final String menuKey = genMenuKey(toolBarPos, menuTitle, null, null);
+	final String subMenuKey = genMenuKey(toolBarPos, menuTitle, menuSubTitle, null);
+	Menu menu = toolbarMenus.get(menuKey);
+	Menu subMenu = toolbarMenus.get(subMenuKey);
+	if (menuSubTitle != null) {
+	    if (subMenu == null) {
+		subMenu = new Menu();
+		final MenuItem subMenuItem = new MenuItem(menuSubTitle, subMenu);
+		if (menu == null) {
+		    menu = createToolbarMenu(toolBarPos, action.getParentMenuIconUrl(), menuTitle, menuKey);
+		}
+		menu.addItem(subMenuItem);
+		toolbarMenus.put(subMenuKey, subMenu);
+	    }
+	    subMenu.addItem(item);
+
+	} else {
+	    // Menu action without submenu
+	    if (menu == null) {
+		menu = createToolbarMenu(toolBarPos, action.getParentMenuIconUrl(), menuTitle, menuKey);
+	    }
+	    menu.addItem(item);
+	}
+	doLayoutIfNeeded(toolBarPos);
+	return item;
+    }
+
+    private Menu createToolbarMenu(final ActionPosition barPosition, final String iconUrl, final String menuTitle,
+	    final String menuKey) {
+	final Menu menu = new Menu();
+	final ToolbarButton toolbarMenu = new ToolbarButton(menuTitle);
+	if (iconUrl != null) {
+	    toolbarMenu.setIcon(iconUrl);
+	}
+	toolbarMenu.addListener(new ButtonListenerAdapter() {
+	    @Override
+	    public void onClick(final Button button, final EventObject e) {
+		menu.showAt(e.getXY());
+	    }
+	});
+	toolbarMenus.put(menuKey, menu);
+	add(barPosition, toolbarMenu);
+	return menu;
+    }
+
+    private void doLayoutIfNeeded() {
+	doLayoutIfNeeded(ActionPosition.topbar);
+	doLayoutIfNeeded(ActionPosition.bottombar);
+    }
+
+    private void doLayoutIfNeeded(final ActionPosition pos) {
+	getToolbar(pos).doLayoutIfNeeded();
+    }
+
+    private String genMenuKey(final ActionPosition pos, final String menuTitle, final String menuSubTitle,
+	    final String actionText) {
+	final String basePart = "km-" + pos.toString() + "-" + menuTitle;
+	final String subMenuPart = menuSubTitle != null ? "-subm-" + menuSubTitle : "";
+	final String itemPart = actionText != null ? "-item-" + actionText : "";
+	return basePart + subMenuPart + itemPart;
+    }
+
+    private Toolbar getToolbar(final ActionPosition pos) {
+	switch (pos) {
+	case bootombarAndItemMenu:
+	case bottombar:
+	    switch (position) {
+	    case content:
+		return ws.getEntityWorkspace().getContentBottomBar();
+	    case context:
+	    default:
+		return ws.getEntityWorkspace().getContextBottomBar();
+	    }
+	case topbar:
+	case topbarAndItemMenu:
+	default:
+	    switch (position) {
+	    case content:
+		return ws.getEntityWorkspace().getContentTopBar();
+	    case context:
+	    default:
+		return ws.getEntityWorkspace().getContextTopBar();
+	    }
+	}
+    }
+}

Added: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/EntityToolbarView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/EntityToolbarView.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/EntityToolbarView.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -0,0 +1,19 @@
+package org.ourproject.kune.workspace.client.ctxnav;
+
+import org.ourproject.kune.platf.client.actions.ActionButtonDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionMenuDescriptor;
+import org.ourproject.kune.platf.client.dto.StateToken;
+
+public interface EntityToolbarView {
+
+    void addButtonAction(ActionButtonDescriptor<StateToken> action);
+
+    void addMenuAction(ActionMenuDescriptor<StateToken> action, boolean enable);
+
+    void clear();
+
+    void clearRemovableActions();
+
+    void disableAllMenuItems();
+
+}

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -88,9 +88,8 @@
 
     public void addCollab(final String groupShortName) {
 	Site.showProgressProcessing();
-	snServiceProvider.get().addCollabMember(session.getUserHash(),
-		session.getCurrentState().getGroup().getShortName(), groupShortName,
-		new AsyncCallbackSimple<SocialNetworkResultDTO>() {
+	snServiceProvider.get().addCollabMember(session.getUserHash(), session.getCurrentState().getStateToken(),
+		groupShortName, new AsyncCallbackSimple<SocialNetworkResultDTO>() {
 		    public void onSuccess(final SocialNetworkResultDTO result) {
 			Site.hideProgress();
 			Site.info(i18n.t("Member added as collaborator"));

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -5,6 +5,7 @@
 import org.ourproject.kune.platf.client.dto.GroupType;
 import org.ourproject.kune.platf.client.dto.SocialNetworkRequestResult;
 import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
 import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync;
 import org.ourproject.kune.platf.client.services.ImageDescriptor;
@@ -104,7 +105,7 @@
 	    public void onEvent(final String parameter) {
 		Site.showProgressProcessing();
 		snServiceProvider.get().requestJoinGroup(session.getUserHash(),
-			session.getCurrentState().getGroup().getShortName(), new AsyncCallbackSimple<Object>() {
+			session.getCurrentState().getStateToken(), new AsyncCallbackSimple<Object>() {
 			    public void onSuccess(final Object result) {
 				Site.hideProgress();
 				final SocialNetworkRequestResult resultType = (SocialNetworkRequestResult) result;
@@ -183,7 +184,7 @@
 		    public void onEvent(final GroupDTO group) {
 			Site.showProgressProcessing();
 			snServiceProvider.get().setAdminAsCollab(session.getUserHash(),
-				session.getCurrentState().getGroup().getShortName(), group.getShortName(),
+				session.getCurrentState().getStateToken(), group.getShortName(),
 				new AsyncCallbackSimple<SocialNetworkResultDTO>() {
 				    public void onSuccess(final SocialNetworkResultDTO result) {
 					Site.hideProgress();
@@ -198,7 +199,7 @@
 		    public void onEvent(final GroupDTO group) {
 			Site.showProgressProcessing();
 			snServiceProvider.get().deleteMember(session.getUserHash(),
-				session.getCurrentState().getGroup().getShortName(), group.getShortName(),
+				session.getCurrentState().getStateToken(), group.getShortName(),
 				new AsyncCallbackSimple<SocialNetworkResultDTO>() {
 				    public void onSuccess(final SocialNetworkResultDTO result) {
 					Site.hideProgress();
@@ -217,7 +218,7 @@
 		    public void onEvent(final GroupDTO group) {
 			Site.showProgressProcessing();
 			snServiceProvider.get().setCollabAsAdmin(session.getUserHash(),
-				session.getCurrentState().getGroup().getShortName(), group.getShortName(),
+				session.getCurrentState().getStateToken(), group.getShortName(),
 				new AsyncCallbackSimple<SocialNetworkResultDTO>() {
 				    public void onSuccess(final SocialNetworkResultDTO result) {
 					Site.hideProgress();
@@ -232,7 +233,7 @@
 		    public void onEvent(final GroupDTO group) {
 			Site.showProgressProcessing();
 			snServiceProvider.get().AcceptJoinGroup(session.getUserHash(),
-				session.getCurrentState().getGroup().getShortName(), group.getShortName(),
+				session.getCurrentState().getStateToken(), group.getShortName(),
 				new AsyncCallbackSimple<SocialNetworkResultDTO>() {
 				    public void onSuccess(final SocialNetworkResultDTO result) {
 					Site.hideProgress();
@@ -247,7 +248,7 @@
 		    public void onEvent(final GroupDTO group) {
 			Site.showProgressProcessing();
 			snServiceProvider.get().denyJoinGroup(session.getUserHash(),
-				session.getCurrentState().getGroup().getShortName(), group.getShortName(),
+				session.getCurrentState().getStateToken(), group.getShortName(),
 				new AsyncCallbackSimple<SocialNetworkResultDTO>() {
 				    public void onSuccess(final SocialNetworkResultDTO result) {
 					Site.hideProgress();
@@ -265,7 +266,7 @@
 
     private void removeMemberAction(final GroupDTO groupDTO) {
 	Site.showProgressProcessing();
-	snServiceProvider.get().unJoinGroup(session.getUserHash(), groupDTO.getShortName(),
+	snServiceProvider.get().unJoinGroup(session.getUserHash(), new StateToken(groupDTO.getShortName()),
 		new AsyncCallbackSimple<SocialNetworkResultDTO>() {
 		    public void onSuccess(final SocialNetworkResultDTO result) {
 			Site.hideProgress();

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/themes/WsThemePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/themes/WsThemePresenter.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/themes/WsThemePresenter.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -49,9 +49,8 @@
 
     protected void onChangeGroupWsTheme(final WsTheme newTheme) {
 	Site.showProgressProcessing();
-	groupServiceProvider.get().changeGroupWsTheme(session.getUserHash(),
-		session.getCurrentState().getGroup().getShortName(), newTheme.getName(),
-		new AsyncCallbackSimple<Object>() {
+	groupServiceProvider.get().changeGroupWsTheme(session.getUserHash(), session.getCurrentState().getStateToken(),
+		newTheme.getName(), new AsyncCallbackSimple<Object>() {
 		    public void onSuccess(final Object result) {
 			setTheme(newTheme);
 			Site.hideProgress();

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePresenter.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePresenter.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -90,21 +90,24 @@
 
     protected void onTitleRename(final String newName) {
 	Site.showProgressSaving();
-	final StateDTO currentState = session.getCurrentState();
-	final StateToken stateToken = currentState.getStateToken();
-	contentServiceProvider.get().rename(session.getUserHash(), currentState.getGroup().getShortName(),
-		stateToken.getEncoded(), newName, new AsyncCallback<String>() {
-		    public void onFailure(final Throwable caught) {
-			view.restoreOldTitle();
-			errorHandler.process(caught);
-		    }
+	final StateToken stateToken = session.getCurrentState().getStateToken();
+	final AsyncCallback<String> asyncCallback = new AsyncCallback<String>() {
+	    public void onFailure(final Throwable caught) {
+		view.restoreOldTitle();
+		errorHandler.process(caught);
+	    }
 
-		    public void onSuccess(final String result) {
-			Site.hideProgress();
-			view.setContentTitle(result);
-			contextNavigatorProvider.get().setItemText(stateToken, newName);
-		    }
-		});
+	    public void onSuccess(final String result) {
+		Site.hideProgress();
+		view.setContentTitle(result);
+		contextNavigatorProvider.get().setItemText(stateToken, newName);
+	    }
+	};
+	if (stateToken.isComplete()) {
+	    contentServiceProvider.get().renameContent(session.getUserHash(), stateToken, newName, asyncCallback);
+	} else {
+	    contentServiceProvider.get().renameContainer(session.getUserHash(), stateToken, newName, asyncCallback);
+	}
 	Site.hideProgress();
     }
 

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentCommentServiceTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentCommentServiceTest.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentCommentServiceTest.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -17,27 +17,27 @@
 
     @Test
     public void commentDefaultContent() throws Exception {
-        doLogin();
-        String commentText = "Some comment";
-        CommentDTO commentDTO = contentService.addComment(session.getHash(), groupName, defaultContent.getDocumentId(),
-                commentText);
-        assertEquals(commentDTO.getText(), commentText);
-        assertEquals(commentDTO.getPositiveVotersCount(), 0);
-        assertEquals(commentDTO.getNegativeVotersCount(), 0);
-        assertEquals(commentDTO.getAbuseInformersCount(), 0);
+	doLogin();
+	final String commentText = "Some comment";
+	final CommentDTO commentDTO = contentService.addComment(session.getHash(), defaultContent.getStateToken(),
+		commentText);
+	assertEquals(commentDTO.getText(), commentText);
+	assertEquals(commentDTO.getPositiveVotersCount(), 0);
+	assertEquals(commentDTO.getNegativeVotersCount(), 0);
+	assertEquals(commentDTO.getAbuseInformersCount(), 0);
     }
 
     @Test(expected = UserMustBeLoggedException.class)
     public void commentWithoutLoginMustFail() throws DefaultException {
-        String commentText = "Some comment";
-        contentService.addComment(session.getHash(), groupName, defaultContent.getDocumentId(), commentText);
+	final String commentText = "Some comment";
+	contentService.addComment(session.getHash(), defaultContent.getStateToken(), commentText);
     }
 
     @Before
     public void init() throws Exception {
-        new IntegrationTestHelper(this);
-        groupName = getDefSiteGroupName();
-        defaultContent = getDefaultContent();
+	new IntegrationTestHelper(this);
+	groupName = getDefSiteGroupName();
+	defaultContent = getDefaultContent();
     }
 
 }

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceAddTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceAddTest.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceAddTest.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -32,8 +32,7 @@
     @Test(expected = UserMustBeLoggedException.class)
     public void noLoggedInShouldThrowIllegalAccess() throws ContentNotFoundException, Exception {
 	defaultContent = getDefaultContent();
-	final Long folderId = defaultContent.getContainer().getId();
-	contentService.addContent(session.getHash(), groupName, folderId, "a name");
+	contentService.addContent(session.getHash(), defaultContent.getContainer().getStateToken(), "a name");
     }
 
     @Test
@@ -46,8 +45,8 @@
 	final AccessRightsDTO groupRights = defaultContent.getGroupRights();
 
 	final String title = "New Content Title";
-	final StateDTO added = contentService.addContent(session.getHash(), groupName, defaultContent.getContainer()
-		.getId(), title);
+	final StateDTO added = contentService.addContent(session.getHash(), defaultContent.getContainer()
+		.getStateToken(), title);
 	assertNotNull(added);
 	final List<ContentDTO> contents = added.getContainer().getContents();
 	assertEquals(title, added.getTitle());
@@ -60,7 +59,7 @@
 	assertNotNull(added.getAccessLists());
 
 	final StateToken newState = added.getStateToken();
-	final StateDTO sameAgain = contentService.getContent(session.getHash(), groupName, newState);
+	final StateDTO sameAgain = contentService.getContent(session.getHash(), newState);
 	assertNotNull(sameAgain);
 	assertEquals(2, sameAgain.getContainer().getContents().size());
 
@@ -72,7 +71,7 @@
 	defaultContent = getDefaultContent();
 	final ContainerDTO parent = defaultContent.getContainer();
 	final String title = "folder name";
-	final StateDTO newState = contentService.addFolder(session.getHash(), groupName, parent.getId(), title,
+	final StateDTO newState = contentService.addFolder(session.getHash(), parent.getStateToken(), title,
 		DocumentClientTool.TYPE_FOLDER);
 	assertNotNull(newState);
 	assertNotNull(newState.getGroupMembers());
@@ -81,7 +80,6 @@
 	assertNotNull(newState.getContainerRights());
 	assertNotNull(newState.getGroupRights());
 	assertNotNull(newState.getRootContainer().getContents().get(0).getRights());
-	assertNotNull(newState.getContainer().getContents().get(0).getRights());
 
 	final ContainerDTO parentAgain = getDefaultContent().getContainer();
 	final ContainerSimpleDTO child = parentAgain.getChilds().get(0);
@@ -97,7 +95,7 @@
 	defaultContent = getDefaultContent();
 	final ContainerDTO parent = defaultContent.getContainer();
 	final String roomName = "testroom";
-	final StateDTO newState = contentService.addRoom(session.getHash(), groupName, parent.getId(), roomName);
+	final StateDTO newState = contentService.addRoom(session.getHash(), parent.getStateToken(), roomName);
 	assertNotNull(newState);
     }
 
@@ -107,11 +105,11 @@
 	defaultContent = getDefaultContent();
 	final ContainerDTO parent = defaultContent.getContainer();
 	final String title = "folder name";
-	final StateDTO newState = contentService.addFolder(session.getHash(), groupName, parent.getId(), title,
+	final StateDTO newState = contentService.addFolder(session.getHash(), parent.getStateToken(), title,
 		DocumentClientTool.TYPE_FOLDER);
 	assertNotNull(newState);
 
-	final StateDTO newState2 = contentService.addFolder(session.getHash(), groupName, parent.getId(), title,
+	final StateDTO newState2 = contentService.addFolder(session.getHash(), parent.getStateToken(), title,
 		DocumentClientTool.TYPE_FOLDER);
 	assertNotNull(newState2);
 

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceGetTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceGetTest.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceGetTest.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -13,12 +13,10 @@
 
 public class ContentServiceGetTest extends ContentServiceIntegrationTest {
 
-    private String groupName;
-
     @Test
     public void contentWithLoggedUserIsEditable() throws Exception {
 	final String userHash = doLogin();
-	final StateDTO response = contentService.getContent(userHash, groupName, new StateToken());
+	final StateDTO response = contentService.getContent(userHash, new StateToken());
 	assertNotNull(response.getContentRights());
 	assertTrue(response.getContentRights().isEditable());
 	// assertTrue(response.getAccessLists().getAdmin().size() == 1);
@@ -27,12 +25,11 @@
     @Before
     public void create() {
 	new IntegrationTestHelper(this);
-	groupName = getDefSiteGroupName();
     }
 
     @Test
     public void defaultCountentShouldExist() throws Exception {
-	final StateDTO content = contentService.getContent(null, groupName, new StateToken());
+	final StateDTO content = contentService.getContent(null, new StateToken());
 	assertNotNull(content);
 	assertNotNull(content.getGroup());
 	assertNotNull(content.getContainer());
@@ -45,39 +42,39 @@
 
     @Test
     public void noContentNotLogged() throws Exception {
-	final StateDTO response = contentService.getContent(null, null, new StateToken());
+	final StateDTO response = contentService.getContent(null, new StateToken());
 	assertNotNull(response);
     }
 
     @Test(expected = ContentNotFoundException.class)
     public void nonExistentContent() throws Exception {
-	contentService.getContent(null, groupName, new StateToken("foo foo foo"));
+	contentService.getContent(null, new StateToken("foo foo foo"));
     }
 
     @Test(expected = ContentNotFoundException.class)
     public void nonExistentContent2() throws Exception {
-	contentService.getContent(null, groupName, new StateToken("site.foofoo"));
+	contentService.getContent(null, new StateToken("site.foofoo"));
     }
 
     @Test(expected = ContentNotFoundException.class)
     public void nonExistentContent3() throws Exception {
-	contentService.getContent(null, groupName, new StateToken("site.docs.foofoo"));
+	contentService.getContent(null, new StateToken("site.docs.foofoo"));
     }
 
     @Test(expected = ContentNotFoundException.class)
     public void nonExistentContent4() throws Exception {
 	final StateDTO stateDTO = getDefaultContent();
-	contentService.getContent(null, groupName, stateDTO.getStateToken().clone().setDocument("dadaas"));
+	contentService.getContent(null, stateDTO.getStateToken().clone().setDocument("dadaas"));
     }
 
     @Test(expected = ContentNotFoundException.class)
     public void nonExistentContent5() throws Exception {
-	contentService.getContent(null, groupName, new StateToken("comm3.docs.19"));
+	contentService.getContent(null, new StateToken("comm3.docs.19"));
     }
 
     @Test
     public void notLoggedUserShouldNotEditDefaultDoc() throws Exception {
-	final StateDTO content = contentService.getContent(null, groupName, new StateToken());
+	final StateDTO content = contentService.getContent(null, new StateToken());
 	assertFalse(content.getContentRights().isAdministrable());
 	assertFalse(content.getContentRights().isEditable());
 	assertTrue(content.getContentRights().isVisible());
@@ -88,7 +85,7 @@
 
     @Test
     public void unknownContent() throws Exception {
-	final StateDTO content = contentService.getContent(null, groupName, new StateToken("site.docs"));
+	final StateDTO content = contentService.getContent(null, new StateToken("site.docs"));
 	assertNotNull(content);
 	assertNotNull(content.getGroup());
 	assertNotNull(content.getContainer());

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceIntegrationTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceIntegrationTest.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceIntegrationTest.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -13,7 +13,7 @@
 
     protected StateDTO getDefaultContent() throws Exception {
 	final StateToken stateToken = new StateToken(getDefSiteGroupName());
-	final StateDTO content = contentService.getContent(session.getHash(), getDefSiteGroupName(), stateToken);
+	final StateDTO content = contentService.getContent(session.getHash(), stateToken);
 	return content;
     }
 

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceSaveTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceSaveTest.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceSaveTest.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -10,7 +10,6 @@
 
 public class ContentServiceSaveTest extends ContentServiceIntegrationTest {
 
-    private String groupName;
     private StateDTO defaultContent;
 
     @Before
@@ -18,7 +17,6 @@
 	new IntegrationTestHelper(this);
 
 	defaultContent = getDefaultContent();
-	groupName = defaultContent.getGroup().getShortName();
 	doLogin();
     }
 
@@ -26,9 +24,9 @@
     public void testSaveAndRetrieve() throws Exception {
 	final String text = "Lorem ipsum dolor sit amet";
 	final int version = defaultContent.getVersion();
-	final int currentVersion = contentService.save(getHash(), groupName, defaultContent.getDocumentId(), text);
+	final int currentVersion = contentService.save(getHash(), defaultContent.getStateToken(), text);
 	assertEquals(version + 2, currentVersion);
-	final StateDTO again = contentService.getContent(getHash(), groupName, defaultContent.getStateToken());
+	final StateDTO again = contentService.getContent(getHash(), defaultContent.getStateToken());
 	assertEquals(text, again.getContent());
 	assertEquals(0, (int) again.getRateByUsers());
 	assertEquals(new Double(0), again.getRate());
@@ -39,9 +37,9 @@
 	final String text = TestDomainHelper.createBigText();
 	;
 	final int version = defaultContent.getVersion();
-	final int currentVersion = contentService.save(getHash(), groupName, defaultContent.getDocumentId(), text);
+	final int currentVersion = contentService.save(getHash(), defaultContent.getStateToken(), text);
 	assertEquals(version + 2, currentVersion);
-	final StateDTO again = contentService.getContent(getHash(), groupName, defaultContent.getStateToken());
+	final StateDTO again = contentService.getContent(getHash(), defaultContent.getStateToken());
 	assertEquals(text, again.getContent());
     }
 

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -1,6 +1,8 @@
 package org.ourproject.kune.platf.integration.content;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import java.util.List;
 
@@ -8,6 +10,7 @@
 import org.junit.Test;
 import org.ourproject.kune.docs.client.DocumentClientTool;
 import org.ourproject.kune.platf.client.dto.ContainerDTO;
+import org.ourproject.kune.platf.client.dto.ContentDTO;
 import org.ourproject.kune.platf.client.dto.StateDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.dto.TagResultDTO;
@@ -19,7 +22,6 @@
 
     private StateDTO defaultContent;
     private String groupShortName;
-    private String defDocument;
 
     @Test
     public void addRemoveAuthor() throws Exception {
@@ -27,21 +29,21 @@
 	assertEquals(1, authors.size());
 	final UserSimpleDTO author = authors.get(0);
 	final String authorShortName = author.getShortName();
-	contentService.removeAuthor(getHash(), groupShortName, defDocument, authorShortName);
+	contentService.removeAuthor(getHash(), defaultContent.getStateToken(), authorShortName);
 	final List<UserSimpleDTO> authors2 = getDefaultContent().getAuthors();
 	assertEquals(0, authors2.size());
-	contentService.addAuthor(getHash(), groupShortName, defDocument, authorShortName);
+	contentService.addAuthor(getHash(), defaultContent.getStateToken(), authorShortName);
 	final List<UserSimpleDTO> authors3 = getDefaultContent().getAuthors();
 	assertEquals(1, authors3.size());
-	contentService.addAuthor(getHash(), groupShortName, defDocument, authorShortName);
+	contentService.addAuthor(getHash(), defaultContent.getStateToken(), authorShortName);
 	final List<UserSimpleDTO> authors4 = getDefaultContent().getAuthors();
 	assertEquals(1, authors4.size());
     }
 
     @Test
     public void contentRateAndRetrieve() throws Exception {
-	contentService.rateContent(getHash(), groupShortName, defDocument, 4.5);
-	final StateDTO again = contentService.getContent(getHash(), groupShortName, defaultContent.getStateToken());
+	contentService.rateContent(getHash(), defaultContent.getStateToken(), 4.5);
+	final StateDTO again = contentService.getContent(getHash(), defaultContent.getStateToken());
 	assertEquals(true, again.isRateable());
 	assertEquals(new Double(4.5), again.getCurrentUserRate());
 	assertEquals(new Double(4.5), again.getRate());
@@ -50,9 +52,8 @@
 
     @Test
     public void contentSetLanguage() throws Exception {
-	contentService.setLanguage(getHash(), groupShortName, defDocument, "es");
-	final StateDTO contentRetrieved = contentService.getContent(getHash(), groupShortName, defaultContent
-		.getStateToken());
+	contentService.setLanguage(getHash(), defaultContent.getStateToken(), "es");
+	final StateDTO contentRetrieved = contentService.getContent(getHash(), defaultContent.getStateToken());
 	assertEquals("es", contentRetrieved.getLanguage().getCode());
     }
 
@@ -60,11 +61,10 @@
     public void folderRename() throws Exception {
 	doLogin();
 	defaultContent = getDefaultContent();
-	final ContainerDTO folder = defaultContent.getContainer();
 
 	final String oldTitle = "some title";
 	String newTitle = "folder new name";
-	final StateDTO newState = contentService.addFolder(session.getHash(), groupShortName, folder.getId(), oldTitle,
+	final StateDTO newState = contentService.addFolder(session.getHash(), defaultContent.getStateToken(), oldTitle,
 		DocumentClientTool.TYPE_FOLDER);
 
 	final ContainerDTO newFolder = newState.getContainer();
@@ -73,24 +73,23 @@
 
 	final StateToken folderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(),
 		newFolder.getId().toString(), null);
-	String result = contentService.rename(getHash(), groupShortName, folderToken.getEncoded(), newTitle);
+	String result = contentService.renameContainer(getHash(), folderToken, newTitle);
 
 	assertEquals(newTitle, result);
 
 	final StateToken newFolderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(),
 		newFolder.getId().toString(), null);
-	StateDTO folderAgain = contentService.getContent(getHash(), groupShortName, newFolderToken);
+	StateDTO folderAgain = contentService.getContent(getHash(), newFolderToken);
 
 	assertEquals(newTitle, folderAgain.getContainer().getName());
 
 	newTitle = "folder last name";
 
-	result = contentService.rename(getHash(), groupShortName, newFolderToken.getEncoded(), newTitle);
+	result = contentService.renameContainer(getHash(), newFolderToken, newTitle);
 
-	folderAgain = contentService.getContent(getHash(), groupShortName, newFolderToken);
+	folderAgain = contentService.getContent(getHash(), newFolderToken);
 
 	assertEquals(newTitle, folderAgain.getContainer().getName());
-
     }
 
     @Test(expected = AccessViolationException.class)
@@ -98,11 +97,11 @@
 	doLogin();
 	defaultContent = getDefaultContent();
 	final ContainerDTO folder = defaultContent.getContainer();
-	final StateToken folderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(), folder
+	final StateToken folderToken = new StateToken("otherGroup", defaultContent.getStateToken().getTool(), folder
 		.getId().toString(), null);
 
 	final String newTitle = "folder new name";
-	contentService.rename(getHash(), super.getSiteAdminShortName(), folderToken.getEncoded(), newTitle);
+	contentService.renameContainer(getHash(), folderToken, newTitle);
     }
 
     @Test(expected = RuntimeException.class)
@@ -114,7 +113,7 @@
 	final String newTitle = "folder new name";
 	final StateToken folderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(), folder
 		.getId().toString(), null);
-	final String result = contentService.rename(getHash(), groupShortName, folderToken.getEncoded(), newTitle);
+	final String result = contentService.renameContainer(getHash(), folderToken, newTitle);
 
 	assertEquals(newTitle, result);
 
@@ -129,13 +128,12 @@
 	doLogin();
 	defaultContent = getDefaultContent();
 	groupShortName = defaultContent.getStateToken().getGroup();
-	defDocument = defaultContent.getStateToken().getDocument();
     }
 
     @Test
     public void setTagsAndResults() throws Exception {
-	contentService.setTags(getHash(), groupShortName, defDocument, "bfoo cfoa afoo2");
-	final List<TagResultDTO> summaryTags = contentService.getSummaryTags(getHash(), groupShortName);
+	contentService.setTags(getHash(), defaultContent.getStateToken(), "bfoo cfoa afoo2");
+	final List<TagResultDTO> summaryTags = contentService.getSummaryTags(getHash(), defaultContent.getStateToken());
 	assertEquals(3, summaryTags.size());
 
 	TagResultDTO tagResultDTO = summaryTags.get(0);
@@ -153,12 +151,27 @@
 
     @Test
     public void setTagsAndRetrieve() throws Exception {
-	contentService.setTags(getHash(), groupShortName, defDocument, "foo foa foo");
+	contentService.setTags(getHash(), defaultContent.getStateToken(), "foo foa foo");
 	final String tagsRetrieved = getDefaultContent().getTags();
 	assertEquals("foo foa", tagsRetrieved);
     }
 
     @Test
+    public void testSetAsDefContent() throws Exception {
+	doLogin();
+	defaultContent = getDefaultContent();
+
+	final StateDTO added = contentService.addContent(session.getHash(), defaultContent.getStateToken(),
+		"New Content Title");
+	assertNotNull(added);
+
+	final ContentDTO newDefContent = contentService.setAsDefaultContent(session.getHash(), added.getStateToken());
+
+	assertTrue(!defaultContent.getStateToken().equals(newDefContent.getStateToken()));
+	assertTrue(added.getStateToken().equals(newDefContent.getStateToken()));
+    }
+
+    @Test
     public void tokenRename() throws Exception {
 	doLogin();
 	defaultContent = getDefaultContent();
@@ -166,23 +179,20 @@
 
 	final String oldTitle = "some title";
 	String newTitle = "folder new name";
-	final StateDTO newState = contentService.addFolder(session.getHash(), groupShortName, folder.getId(), oldTitle,
+	final StateDTO newState = contentService.addFolder(session.getHash(), folder.getStateToken(), oldTitle,
 		DocumentClientTool.TYPE_FOLDER);
 
 	final ContainerDTO newFolder = newState.getContainer();
 
 	assertEquals(oldTitle, newFolder.getName());
 
-	final StateToken newFolderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(),
-		newFolder.getId().toString(), null);
-
 	newTitle = "folder last name";
 
-	final String result = contentService.rename(getHash(), groupShortName, newFolderToken.getEncoded(), newTitle);
+	final String result = contentService.renameContainer(getHash(), newState.getStateToken(), newTitle);
 
 	assertEquals(newTitle, result);
 
-	final StateDTO folderAgain = contentService.getContent(getHash(), groupShortName, newFolderToken);
+	final StateDTO folderAgain = contentService.getContent(getHash(), newState.getStateToken());
 
 	assertEquals(newTitle, folderAgain.getContainer().getName());
     }

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/socialnet/SocialNetworkServiceTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/socialnet/SocialNetworkServiceTest.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/socialnet/SocialNetworkServiceTest.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -6,6 +6,7 @@
 import org.junit.Test;
 import org.ourproject.kune.platf.client.dto.ParticipationDataDTO;
 import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.errors.AlreadyUserMemberException;
 import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
 import org.ourproject.kune.platf.client.rpc.SocialNetworkService;
@@ -21,35 +22,35 @@
     @Inject
     SocialNetworkService socialNetworkService;
 
-    private String groupShortName;
+    private StateToken groupToken;
 
     @Before
     public void init() {
 	new IntegrationTestHelper(this);
-	groupShortName = getDefSiteGroupName();
+	groupToken = new StateToken(getDefSiteGroupName());
     }
 
     @Test
     public void testGetGroupMembersNotLogged() throws Exception {
-	final SocialNetworkDTO groupMembers = socialNetworkService.getGroupMembers(null, groupShortName);
+	final SocialNetworkDTO groupMembers = socialNetworkService.getGroupMembers(null, groupToken);
 	assertNotNull(groupMembers);
     }
 
     @Test
     public void testGetParticipationNotLogged() throws Exception {
-	final ParticipationDataDTO participation = socialNetworkService.getParticipation(null, groupShortName);
+	final ParticipationDataDTO participation = socialNetworkService.getParticipation(null, groupToken);
 	assertNotNull(participation);
     }
 
     @Test(expected = UserMustBeLoggedException.class)
     public void testRequestJoinNoLogged() throws Exception {
-	socialNetworkService.requestJoinGroup(session.getHash(), groupShortName);
+	socialNetworkService.requestJoinGroup(session.getHash(), groupToken);
     }
 
     @Test(expected = AlreadyUserMemberException.class)
     public void testRequestJoinPersonalGroup() throws Exception {
 	doLogin();
-	socialNetworkService.requestJoinGroup(session.getHash(), groupShortName);
+	socialNetworkService.requestJoinGroup(session.getHash(), groupToken);
     }
 
 }

Modified: trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptorTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptorTest.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptorTest.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -32,24 +32,24 @@
     @Test(expected = UserMustBeLoggedException.class)
     public void hashNullAndMandatoryMustDoNothing() throws Throwable {
 	Mockito.stub(authAnnotation.mandatory()).toReturn(true);
-	final Object[] result = { null };
-	Mockito.stub(invocation.getArguments()).toReturn(result);
+	final Object[] arguments = { null };
+	Mockito.stub(invocation.getArguments()).toReturn(arguments);
 	auth.invoke(invocation);
     }
 
     @Test
     public void hashNullAndNotMandatoryMustDoNothing() throws Throwable {
 	Mockito.stub(authAnnotation.mandatory()).toReturn(false);
-	final Object[] result = { null };
-	Mockito.stub(invocation.getArguments()).toReturn(result);
+	final Object[] arguments = { null };
+	Mockito.stub(invocation.getArguments()).toReturn(arguments);
 	auth.invoke(invocation);
     }
 
     @Test
     public void hashNullAsStringAndNotMandatoryMustDoNothing() throws Throwable {
 	Mockito.stub(authAnnotation.mandatory()).toReturn(false);
-	final Object[] result = { "null" };
-	Mockito.stub(invocation.getArguments()).toReturn(result);
+	final Object[] arguments = { "null" };
+	Mockito.stub(invocation.getArguments()).toReturn(arguments);
 	auth.invoke(invocation);
     }
 
@@ -57,8 +57,8 @@
     public void otherHashAndMandatoryAndLoggedMustSessionExp() throws Throwable {
 	doLogin();
 	Mockito.stub(authAnnotation.mandatory()).toReturn(true);
-	final Object[] result = { "other-hash" };
-	Mockito.stub(invocation.getArguments()).toReturn(result);
+	final Object[] arguments = { "other-hash" };
+	Mockito.stub(invocation.getArguments()).toReturn(arguments);
 	auth.invoke(invocation);
     }
 
@@ -66,16 +66,16 @@
     public void sameHashAndMandatoryAndLoggedMustSessionExp() throws Throwable {
 	doLogin();
 	Mockito.stub(authAnnotation.mandatory()).toReturn(true);
-	final Object[] result = { getHash() };
-	Mockito.stub(invocation.getArguments()).toReturn(result);
+	final Object[] arguments = { getHash() };
+	Mockito.stub(invocation.getArguments()).toReturn(arguments);
 	auth.invoke(invocation);
     }
 
     @Test(expected = SessionExpiredException.class)
     public void someHashAndMandatoryAndNotLoggedMustSessionExp() throws Throwable {
 	Mockito.stub(authAnnotation.mandatory()).toReturn(true);
-	final Object[] result = { "some-hash" };
-	Mockito.stub(invocation.getArguments()).toReturn(result);
+	final Object[] arguments = { "some-hash" };
+	Mockito.stub(invocation.getArguments()).toReturn(arguments);
 	auth.invoke(invocation);
     }
 }

Modified: trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptorTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptorTest.java	2008-09-15 04:12:48 UTC (rev 871)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptorTest.java	2008-09-18 00:45:41 UTC (rev 872)
@@ -4,9 +4,14 @@
 
 import org.aopalliance.intercept.MethodInvocation;
 import org.junit.Before;
+import org.junit.Test;
 import org.mockito.Mockito;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.errors.AccessViolationException;
+import org.ourproject.kune.platf.client.errors.ContentNotFoundException;
 import org.ourproject.kune.platf.integration.IntegrationTest;
 import org.ourproject.kune.platf.integration.IntegrationTestHelper;
+import org.ourproject.kune.platf.server.access.AccessRol;
 
 public class AuthorizatedMethodInterceptorTest extends IntegrationTest {
 
@@ -24,8 +29,34 @@
 	Mockito.stub(invocation.getStaticPart()).toReturn(accessibleObject);
 	authAnnotation = Mockito.mock(Authorizated.class);
 	Mockito.stub(accessibleObject.getAnnotation(Authorizated.class)).toReturn(authAnnotation);
-	// AccessType accessType = authoAnnotation.accessTypeRequired();
-	// boolean checkContent = authoAnnotation.checkContent();
+
     }
 
+    @Test(expected = ContentNotFoundException.class)
+    public void tesHashNullContainer() throws Throwable {
+	// Mockito.stub(authAnnotation.accessRolRequired()).toReturn(AccessRol.Administrator);
+	Mockito.stub(authAnnotation.actionLevel()).toReturn(ActionLevel.content);
+	final Object[] arguments = { getHash(), new StateToken("group.docs") };
+	Mockito.stub(invocation.getArguments()).toReturn(arguments);
+	auth.invoke(invocation);
+    }
+
+    @Test(expected = ContentNotFoundException.class)
+    public void testHashNullContent() throws Throwable {
+	Mockito.stub(authAnnotation.actionLevel()).toReturn(ActionLevel.content);
+	final Object[] arguments = { getHash(), new StateToken("group.docs.1") };
+	Mockito.stub(invocation.getArguments()).toReturn(arguments);
+	auth.invoke(invocation);
+    }
+
+    @Test(expected = AccessViolationException.class)
+    public void wrongGroupNameThrowsExcep() throws Throwable {
+	doLogin();
+	Mockito.stub(authAnnotation.accessRolRequired()).toReturn(AccessRol.Administrator);
+	Mockito.stub(authAnnotation.actionLevel()).toReturn(ActionLevel.content);
+	final Object[] arguments = { getHash(), new StateToken("groupWRONG.docs.1.1") };
+	Mockito.stub(invocation.getArguments()).toReturn(arguments);
+	auth.invoke(invocation);
+    }
+
 }




More information about the kune-commits mailing list