This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository bow. See http://git.chorem.org/bow.git commit 684dfaa732914a32f3ee689508c84530f06c3223 Author: Benjamin POUSSIN <poussin@codelutin.com> Date: Tue Jul 28 03:13:32 2015 +0200 add support to share with user without bow login --- bow-ui/src/main/java/org/chorem/bow/BowConfig.java | 1 + bow-ui/src/main/java/org/chorem/bow/BowUtils.java | 19 +++ .../java/org/chorem/bow/action/AtomAction.java | 4 +- .../bow/action/bookmark/AddOrUpdateAction.java | 61 ++++++++- .../org/chorem/bow/action/bookmark/EditAction.java | 11 ++ .../chorem/bow/action/group/GroupViewAction.java | 5 +- .../bow/action/login/ForgotPasswordAction.java | 4 +- .../org/chorem/bow/action/login/LoginAction.java | 2 + .../chorem/bow/action/login/RegisterAction.java | 4 +- .../action/sharedUser/SharedUserEditAction.java | 148 +++++++++++++++++++++ .../SharedUserViewAction.java} | 29 ++-- .../main/resources/i18n/bow-ui_en_GB.properties | 7 + .../main/resources/i18n/bow-ui_fr_FR.properties | 7 + bow-ui/src/main/resources/struts.xml | 20 +++ .../src/main/webapp/WEB-INF/jsp/editBookmark.jsp | 1 + bow-ui/src/main/webapp/WEB-INF/jsp/inc/footer.jsp | 2 +- .../src/main/webapp/WEB-INF/jsp/inc/rightMenu.jsp | 51 +++---- .../src/main/webapp/WEB-INF/jsp/sharedUserEdit.jsp | 62 +++++++++ .../src/main/webapp/WEB-INF/jsp/sharedUserView.jsp | 77 +++++++++++ bow-ui/src/main/webapp/js/README | 36 +++++ bow-ui/src/main/xmi/README | 30 ++++- bow-ui/src/main/xmi/bow-model.properties | 2 + bow-ui/src/main/xmi/bow-model.zargo | Bin 10532 -> 11957 bytes 23 files changed, 529 insertions(+), 54 deletions(-) diff --git a/bow-ui/src/main/java/org/chorem/bow/BowConfig.java b/bow-ui/src/main/java/org/chorem/bow/BowConfig.java index b478689..81a6d66 100644 --- a/bow-ui/src/main/java/org/chorem/bow/BowConfig.java +++ b/bow-ui/src/main/java/org/chorem/bow/BowConfig.java @@ -39,6 +39,7 @@ public class BowConfig { private static final Log log = LogFactory.getLog(BowConfig.class); public static final String GROUP_MARK = "@"; + public static final String USER_MARK = "#"; /** Singleton instance. */ protected static ApplicationConfig config; diff --git a/bow-ui/src/main/java/org/chorem/bow/BowUtils.java b/bow-ui/src/main/java/org/chorem/bow/BowUtils.java index 172d18a..af80bcd 100644 --- a/bow-ui/src/main/java/org/chorem/bow/BowUtils.java +++ b/bow-ui/src/main/java/org/chorem/bow/BowUtils.java @@ -126,6 +126,25 @@ public class BowUtils { * @param tags * @return */ + public static Set<String> getUsers(Set<String> tags) { + Set<String> result = new HashSet<String>(); + if (CollectionUtils.isNotEmpty(tags)) { + for (String t : tags) { + if (StringUtils.startsWith(t, BowConfig.USER_MARK)) { + result.add(StringUtils.substringAfter(t, BowConfig.USER_MARK)); + } + } + } + return result; + } + + /** + * Recupere la liste des noms des groupes parmi les tags. Un groupe dans + * les tags commence par "@" mais son nom ne contient pas ce '@'. Il est + * donc retire avant d'etre retourne. + * @param tags + * @return + */ public static Set<String> getGroups(Set<String> tags) { Set<String> result = new HashSet<String>(); if (CollectionUtils.isNotEmpty(tags)) { diff --git a/bow-ui/src/main/java/org/chorem/bow/action/AtomAction.java b/bow-ui/src/main/java/org/chorem/bow/action/AtomAction.java index adadeb5..b4efed0 100644 --- a/bow-ui/src/main/java/org/chorem/bow/action/AtomAction.java +++ b/bow-ui/src/main/java/org/chorem/bow/action/AtomAction.java @@ -82,7 +82,7 @@ public class AtomAction extends BowBaseAction { @Override public String execute() throws Exception { if (log.isDebugEnabled()) { - log.debug(String.format("Rss for tags='%' fulltext='%s' count='%s'" + tagLine, fullTextLine, count)); + log.debug(String.format("Rss for tags='%' fulltext='%s' count='%s'", tagLine, fullTextLine, count)); } String result = SUCCESS; try { @@ -100,7 +100,7 @@ public class AtomAction extends BowBaseAction { date = new Date(); if (log.isDebugEnabled()) { - log.debug(String.format("Rss found='%s'" + bookmarks.size())); + log.debug(String.format("Rss found='%s'", bookmarks.size())); } } catch (Exception eee) { diff --git a/bow-ui/src/main/java/org/chorem/bow/action/bookmark/AddOrUpdateAction.java b/bow-ui/src/main/java/org/chorem/bow/action/bookmark/AddOrUpdateAction.java index 1265c38..f04aca9 100644 --- a/bow-ui/src/main/java/org/chorem/bow/action/bookmark/AddOrUpdateAction.java +++ b/bow-ui/src/main/java/org/chorem/bow/action/bookmark/AddOrUpdateAction.java @@ -35,6 +35,7 @@ import org.chorem.bow.BowBookmarkImpl; import org.chorem.bow.BowConfig; import org.chorem.bow.BowGroup; import org.chorem.bow.BowProxy; +import org.chorem.bow.BowSharedUser; import org.chorem.bow.BowUser; import org.chorem.bow.BowUtils; import org.chorem.bow.action.BowBaseAction; @@ -70,6 +71,12 @@ public class AddOrUpdateAction extends BowBaseAction { protected String redirectTo; + /** if true, force to go edit after add */ + protected boolean forceEdit; + + /** if true force to go to link after save, or forward redirectLink to edit page */ + protected boolean redirectLink; + public String getBookmarkId() { return bookmarkId; } @@ -141,6 +148,22 @@ public class AddOrUpdateAction extends BowBaseAction { return redirectTo; } + public boolean isForceEdit() { + return forceEdit; + } + + public void setForceEdit(boolean forceEdit) { + this.forceEdit = forceEdit; + } + + public boolean isRedirectLink() { + return redirectLink; + } + + public void setRedirectLink(boolean redirectLink) { + this.redirectLink = redirectLink; + } + @Override public String execute() { String result = SUCCESS; @@ -237,6 +260,7 @@ public class AddOrUpdateAction extends BowBaseAction { Set<String> tagsWord = BowUtils.getWords(tags); bookmark.setLabels(tagsWord); + HashSet<String> authParent = new HashSet<String>(); // add in WikittyAuthorisation.parent all groups (tag start with @) // where current user is member Set<String> groupsName = BowUtils.getGroups(tagsWord); @@ -246,7 +270,7 @@ public class AddOrUpdateAction extends BowBaseAction { .eq(BowGroup.ELEMENT_FIELD_WIKITTYGROUP_MEMBERS, userId) .end(); WikittyQueryResult<String> groupsId = proxy.findAllByQuery(groupsQuery); - bookmark.setParent(new HashSet<String>(groupsId.getAll())); + authParent.addAll(groupsId.getAll()); if (groupsName.size() != groupsId.size()) { List<BowGroup> groups = proxy.restore(BowGroup.class, groupsId.getAll()); @@ -259,6 +283,33 @@ public class AddOrUpdateAction extends BowBaseAction { addActionMessage(t("bow.group.not.members", StringUtils.join(groupsName, ", "))); } } + // add new permission parent (group) + bookmark.setParent(authParent); + + + HashSet<String> authReader = new HashSet<String>(); + // add in WikittyAuthorisation.parent all sharedUsers (tag start with #) + Set<String> usersLogin = BowUtils.getUsers(tagsWord); + if (CollectionUtils.isNotEmpty(usersLogin)) { + WikittyQuery sharedUsersQuery = new WikittyQueryMaker().and() + .containsOne(BowUser.ELEMENT_FIELD_WIKITTYUSER_LOGIN, usersLogin) + .end(); + WikittyQueryResult<String> sharedUsersId = proxy.findAllByQuery(sharedUsersQuery); + authReader.addAll(sharedUsersId.getAll()); + + if (usersLogin.size() != sharedUsersId.size()) { + List<BowSharedUser> sharedUsers = proxy.restore(BowSharedUser.class, sharedUsersId.getAll()); + for (BowSharedUser g : sharedUsers) { + usersLogin.remove(g.getLogin()); + } + for (String sharedUserName : usersLogin) { + bookmark.removeLabels(BowConfig.USER_MARK + sharedUserName); + } + addActionMessage(t("bow.user.not.found", StringUtils.join(usersLogin, ", "))); + } + } + // add new permission reader (user) + bookmark.setReader(authReader); // Si l'alias prive souhaite est deja utilise on ne l'accept pas // Si l'alias public souhaite est deja utilise on ne l'accept pas @@ -301,10 +352,12 @@ public class AddOrUpdateAction extends BowBaseAction { log.debug("Adding URL"); } - if (isScriptlet && StringUtils.isBlank(bookmark.getDescription()) - && CollectionUtils.isEmpty(bookmark.getLabels())) { + if (forceEdit || (isScriptlet && (StringUtils.isBlank(bookmark.getDescription()) + || CollectionUtils.isEmpty(bookmark.getLabels())))) { // le bookmark est trop peu renseigne, on renvoie vers l'edition - redirectTo = String.format("editBookmark.action?id=%s", bookmark.getWikittyId()); + redirectTo = String.format("editBookmark.action?redirectLink=%s&id=%s", redirectLink, bookmark.getWikittyId()); + } else if (redirectLink) { + redirectTo = bookmark.getLink(); } else { // on essai d'afficher l'entree ajoutee/modifiee if (StringUtils.isEmpty(tagLine) && StringUtils.isEmpty(fullTextLine)) { diff --git a/bow-ui/src/main/java/org/chorem/bow/action/bookmark/EditAction.java b/bow-ui/src/main/java/org/chorem/bow/action/bookmark/EditAction.java index 2cdf87b..c68e1df 100644 --- a/bow-ui/src/main/java/org/chorem/bow/action/bookmark/EditAction.java +++ b/bow-ui/src/main/java/org/chorem/bow/action/bookmark/EditAction.java @@ -43,6 +43,9 @@ public class EditAction extends BowBaseAction { protected BowBookmark bookmark; + /** if true force to go to link after save, or forward redirectLink to edit page */ + protected boolean redirectLink; + public String getId() { return id; } @@ -58,6 +61,14 @@ public class EditAction extends BowBaseAction { return bookmark; } + public boolean isRedirectLink() { + return redirectLink; + } + + public void setRedirectLink(boolean redirectLink) { + this.redirectLink = redirectLink; + } + @Override public String execute() throws Exception { if (id == null) { diff --git a/bow-ui/src/main/java/org/chorem/bow/action/group/GroupViewAction.java b/bow-ui/src/main/java/org/chorem/bow/action/group/GroupViewAction.java index 5efbe64..9833bc1 100644 --- a/bow-ui/src/main/java/org/chorem/bow/action/group/GroupViewAction.java +++ b/bow-ui/src/main/java/org/chorem/bow/action/group/GroupViewAction.java @@ -21,8 +21,6 @@ package org.chorem.bow.action.group; import java.util.List; -import java.util.Set; -import org.apache.commons.collections.CollectionUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.bow.BowGroup; @@ -33,7 +31,6 @@ import org.chorem.bow.action.BowBaseAction; import org.nuiton.wikitty.query.WikittyQuery; import org.nuiton.wikitty.query.WikittyQueryMaker; import org.nuiton.wikitty.query.WikittyQueryResult; -import org.nuiton.wikitty.services.WikittyServiceAuthorisation; /** * Used view groups @@ -74,7 +71,7 @@ public class GroupViewAction extends BowBaseAction { groups = proxy.restore(BowGroup.class, groupsId.getAll(), "WikittyGroup.members"); if (log.isDebugEnabled()) { - log.debug(String.format("Group found='%s'" + groups.size())); + log.debug(String.format("Group found='%s'", groups.size())); } } catch (Exception eee) { diff --git a/bow-ui/src/main/java/org/chorem/bow/action/login/ForgotPasswordAction.java b/bow-ui/src/main/java/org/chorem/bow/action/login/ForgotPasswordAction.java index 15bb152..ba9bebe 100644 --- a/bow-ui/src/main/java/org/chorem/bow/action/login/ForgotPasswordAction.java +++ b/bow-ui/src/main/java/org/chorem/bow/action/login/ForgotPasswordAction.java @@ -32,6 +32,7 @@ import javax.mail.internet.AddressException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.bow.BowProxy; +import org.chorem.bow.BowSharedUser; import org.nuiton.wikitty.query.WikittyQuery; import org.nuiton.wikitty.query.WikittyQueryMaker; @@ -71,7 +72,8 @@ public class ForgotPasswordAction extends BowBaseAction { if (StringUtils.isNotBlank(email)) { email = email.trim(); BowProxy proxy = getBowProxy(); - WikittyQuery criteria = new WikittyQueryMaker() + WikittyQuery criteria = new WikittyQueryMaker().and() + .extne(BowSharedUser.EXT_BOWSHAREDUSER) .eq(BowUser.FQ_FIELD_WIKITTYUSER_LOGIN, email).end(); BowUser user = proxy.findByQuery(BowUser.class, criteria); diff --git a/bow-ui/src/main/java/org/chorem/bow/action/login/LoginAction.java b/bow-ui/src/main/java/org/chorem/bow/action/login/LoginAction.java index 4782b97..c540ce9 100644 --- a/bow-ui/src/main/java/org/chorem/bow/action/login/LoginAction.java +++ b/bow-ui/src/main/java/org/chorem/bow/action/login/LoginAction.java @@ -26,6 +26,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.bow.BowConfig; import org.chorem.bow.BowProxy; +import org.chorem.bow.BowSharedUser; import org.chorem.bow.BowUser; import org.chorem.bow.BowUserImpl; import org.chorem.bow.action.BowBaseAction; @@ -75,6 +76,7 @@ public class LoginAction extends BowBaseAction { BowProxy proxy = getBowProxy(); WikittyQuery criteria = new WikittyQueryMaker().and() + .extne(BowSharedUser.EXT_BOWSHAREDUSER) .eq(BowUser.FQ_FIELD_WIKITTYUSER_LOGIN, email) .eq(BowUser.FQ_FIELD_WIKITTYUSER_PASSWORD, password).end(); result = proxy.findByQuery(BowUser.class, criteria); diff --git a/bow-ui/src/main/java/org/chorem/bow/action/login/RegisterAction.java b/bow-ui/src/main/java/org/chorem/bow/action/login/RegisterAction.java index 6763f53..7706a6d 100644 --- a/bow-ui/src/main/java/org/chorem/bow/action/login/RegisterAction.java +++ b/bow-ui/src/main/java/org/chorem/bow/action/login/RegisterAction.java @@ -33,6 +33,7 @@ import javax.mail.internet.AddressException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.bow.BowProxy; +import org.chorem.bow.BowSharedUser; import org.nuiton.wikitty.query.WikittyQuery; import org.nuiton.wikitty.query.WikittyQueryMaker; @@ -93,7 +94,8 @@ public class RegisterAction extends BowBaseAction { BowProxy proxy = getBowProxy(); //Retrieves user by user name (email) - WikittyQuery criteria = new WikittyQueryMaker() + WikittyQuery criteria = new WikittyQueryMaker().and() + .extne(BowSharedUser.EXT_BOWSHAREDUSER) .eq(BowUser.FQ_FIELD_WIKITTYUSER_LOGIN, email).end(); result = proxy.findByQuery(BowUser.class, criteria) != null; diff --git a/bow-ui/src/main/java/org/chorem/bow/action/sharedUser/SharedUserEditAction.java b/bow-ui/src/main/java/org/chorem/bow/action/sharedUser/SharedUserEditAction.java new file mode 100644 index 0000000..5631b92 --- /dev/null +++ b/bow-ui/src/main/java/org/chorem/bow/action/sharedUser/SharedUserEditAction.java @@ -0,0 +1,148 @@ +/* + * #%L + * BOW UI + * %% + * Copyright (C) 2010 - 2015 CodeLutin + * %% + * 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 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/>. + * #L% + */ +package org.chorem.bow.action.sharedUser; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.bow.BowSharedUser; +import org.chorem.bow.BowSharedUserImpl; +import org.chorem.bow.BowProxy; +import org.chorem.bow.BowSession; +import org.chorem.bow.BowUser; +import org.chorem.bow.BowUtils; +import org.chorem.bow.action.BowBaseAction; +import org.nuiton.wikitty.entities.Wikitty; +import org.nuiton.wikitty.entities.WikittyUserHelper; +import org.nuiton.wikitty.query.WikittyQuery; +import org.nuiton.wikitty.query.WikittyQueryMaker; +import org.nuiton.wikitty.query.WikittyQueryResult; + +/** + * Handles RSS flux demande + * - tagLine + * - fullTextLine + * - count: number of bookmark to retrieve + * + * @author poussin + * @version $Revision$ + * <p/> + * Last update: $Date$ + * by : $Author$ + */ +public class SharedUserEditAction extends BowBaseAction { + + /** to use log facility, just put in your code: log.info(\"...\"); */ + private static final Log log = LogFactory.getLog(SharedUserEditAction.class); + + private static final long serialVersionUID = 1L; + + protected String sharedUserId; + protected BowSharedUser sharedUser; + + public String getSharedUserId() { + return sharedUserId; + } + + public void setSharedUserId(String sharedUserId) { + this.sharedUserId = sharedUserId; + } + + public BowSharedUser getSharedUser() { + if (sharedUser == null) { + loadSharedUser(); + } + return sharedUser; + } + + public void loadSharedUser() { + if (log.isDebugEnabled()) { + log.debug("sharedUser load " + sharedUser); + } + BowProxy proxy = getBowProxy(); + if (StringUtils.isBlank(sharedUserId)) { + sharedUser = new BowSharedUserImpl(); + + BowSession session = getBowSession(); + BowUser user = session.getUser(); + sharedUser.setOwner(user); + + String permanentToken = BowUtils.generateToken(); + sharedUser.setPermanentToken(permanentToken); + } else { + sharedUser = proxy.restore(BowSharedUser.class, sharedUserId); + } + if (log.isDebugEnabled()) { + log.debug("sharedUser loaded " + sharedUser); + } + } + + public String load() throws Exception { + return SUCCESS; + } + + public String save() throws Exception { + if (log.isDebugEnabled()) { + log.debug("sharedUser save " + sharedUser); + } + String result = SUCCESS; + try { + BowSession session = getBowSession(); + BowProxy proxy = session.getProxy(); + + if (StringUtils.isNotBlank(sharedUser.getLogin())) { + proxy.store(sharedUser); + } else { + addActionError(t("bow.sharedUser.name.blank")); + result = ERROR; + } + + } catch (Exception eee) { + addActionError(t("bow.error.internal")); + log.error(eee.getMessage(), eee); + result = ERROR; + } + return result; + } + + public String delete() throws Exception { + if (log.isDebugEnabled()) { + log.debug("sharedUser delete " + sharedUser); + } + String result = SUCCESS; + try { + BowSession session = getBowSession(); + BowProxy proxy = session.getProxy(); + proxy.delete(sharedUserId); + + } catch (Exception eee) { + addActionError(t("bow.error.internal")); + log.error(eee.getMessage(), eee); + result = ERROR; + } + return result; + } + +} diff --git a/bow-ui/src/main/java/org/chorem/bow/action/group/GroupViewAction.java b/bow-ui/src/main/java/org/chorem/bow/action/sharedUser/SharedUserViewAction.java similarity index 70% copy from bow-ui/src/main/java/org/chorem/bow/action/group/GroupViewAction.java copy to bow-ui/src/main/java/org/chorem/bow/action/sharedUser/SharedUserViewAction.java index 5efbe64..d491699 100644 --- a/bow-ui/src/main/java/org/chorem/bow/action/group/GroupViewAction.java +++ b/bow-ui/src/main/java/org/chorem/bow/action/sharedUser/SharedUserViewAction.java @@ -18,25 +18,22 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -package org.chorem.bow.action.group; +package org.chorem.bow.action.sharedUser; import java.util.List; -import java.util.Set; -import org.apache.commons.collections.CollectionUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.bow.BowGroup; import org.chorem.bow.BowProxy; import org.chorem.bow.BowSession; +import org.chorem.bow.BowSharedUser; import org.chorem.bow.BowUser; import org.chorem.bow.action.BowBaseAction; import org.nuiton.wikitty.query.WikittyQuery; import org.nuiton.wikitty.query.WikittyQueryMaker; import org.nuiton.wikitty.query.WikittyQueryResult; -import org.nuiton.wikitty.services.WikittyServiceAuthorisation; /** - * Used view groups + * Used view ss * * @author poussin * @version $Revision$ @@ -44,17 +41,17 @@ import org.nuiton.wikitty.services.WikittyServiceAuthorisation; * Last update: $Date$ * by : $Author$ */ -public class GroupViewAction extends BowBaseAction { +public class SharedUserViewAction extends BowBaseAction { /** to use log facility, just put in your code: log.info(\"...\"); */ - private static final Log log = LogFactory.getLog(GroupViewAction.class); + private static final Log log = LogFactory.getLog(SharedUserViewAction.class); private static final long serialVersionUID = 1L; - protected List<BowGroup> groups; + protected List<BowSharedUser> sharedUsers; - public List<BowGroup> getGroups() { - return groups; + public List<BowSharedUser> getSharedUsers() { + return sharedUsers; } @Override @@ -68,13 +65,13 @@ public class GroupViewAction extends BowBaseAction { BowProxy proxy = session.getProxy(); WikittyQuery criteria = new WikittyQueryMaker().and() - .exteq(BowGroup.EXT_BOWGROUP) - .eq(BowGroup.ELEMENT_FIELD_WIKITTYGROUP_MEMBERS, user).end(); - WikittyQueryResult<String> groupsId = proxy.findAllByQuery(criteria); - groups = proxy.restore(BowGroup.class, groupsId.getAll(), "WikittyGroup.members"); + .exteq(BowSharedUser.EXT_BOWSHAREDUSER) + .eq(BowSharedUser.ELEMENT_FIELD_BOWSHAREDUSER_OWNER, user).end(); + WikittyQueryResult<String> sharedUsersId = proxy.findAllByQuery(criteria); + sharedUsers = proxy.restore(BowSharedUser.class, sharedUsersId.getAll()); if (log.isDebugEnabled()) { - log.debug(String.format("Group found='%s'" + groups.size())); + log.debug(String.format("SharedUser found='%s'", sharedUsers.size())); } } catch (Exception eee) { diff --git a/bow-ui/src/main/resources/i18n/bow-ui_en_GB.properties b/bow-ui/src/main/resources/i18n/bow-ui_en_GB.properties index 4bdfcad..587e7c8 100644 --- a/bow-ui/src/main/resources/i18n/bow-ui_en_GB.properties +++ b/bow-ui/src/main/resources/i18n/bow-ui_en_GB.properties @@ -183,6 +183,13 @@ bow.search.orderby=Order by bow.search.results.deleted=Search results deleted successfully bow.search.submit=Search bow.search.title=Search +bow.sharedUser.new= +bow.sharedUserEdit.delete= +bow.sharedUserEdit.description= +bow.sharedUserEdit.name= +bow.sharedUserEdit.save= +bow.sharedUserEdit.title= +bow.sharedUserView.title= bow.temporary.link.search=Temporary search URL bow.temporary.link.searchDescription=Temporary link (session) to use Bow as search engine in your browser bow.temporary.link.suggestion=Temporary suggest URL diff --git a/bow-ui/src/main/resources/i18n/bow-ui_fr_FR.properties b/bow-ui/src/main/resources/i18n/bow-ui_fr_FR.properties index 624c653..7ec65bf 100644 --- a/bow-ui/src/main/resources/i18n/bow-ui_fr_FR.properties +++ b/bow-ui/src/main/resources/i18n/bow-ui_fr_FR.properties @@ -183,6 +183,13 @@ bow.search.orderby=Trier par bow.search.results.deleted=Les résultats de la recherche ont été supprimés avec succès bow.search.submit=Rechercher bow.search.title=Recherche +bow.sharedUser.new= +bow.sharedUserEdit.delete= +bow.sharedUserEdit.description= +bow.sharedUserEdit.name= +bow.sharedUserEdit.save= +bow.sharedUserEdit.title= +bow.sharedUserView.title= bow.temporary.link.search=URL de recherche temporaire bow.temporary.link.searchDescription=Lien temporaire (le temps de la session) pour utiliser Bow comme moteur de recherche dans votre navigateur bow.temporary.link.suggestion=URL de suggesion temporaire diff --git a/bow-ui/src/main/resources/struts.xml b/bow-ui/src/main/resources/struts.xml index ac94790..5f8a358 100644 --- a/bow-ui/src/main/resources/struts.xml +++ b/bow-ui/src/main/resources/struts.xml @@ -185,6 +185,26 @@ </action> </package> + <package name="sharedUser" extends="restrictedArea"> + <action name="sharedUserView" class="org.chorem.bow.action.sharedUser.SharedUserViewAction"> + <result name="error">/WEB-INF/jsp/sharedUserView.jsp</result> + <result>/WEB-INF/jsp/sharedUserView.jsp</result> + </action> + <action name="sharedUserEdit" class="org.chorem.bow.action.sharedUser.SharedUserEditAction" method="load"> + <result name="error">/WEB-INF/jsp/sharedUserEdit.jsp</result> + <result>/WEB-INF/jsp/sharedUserEdit.jsp</result> + </action> + <action name="sharedUserSave" class="org.chorem.bow.action.sharedUser.SharedUserEditAction" method="save"> + <result name="input">/WEB-INF/jsp/home.jsp</result> + <result name="error">/WEB-INF/jsp/sharedUserEdit.jsp</result> + <result type="redirectAction">sharedUserView</result> + </action> + <action name="sharedUserDelete" class="org.chorem.bow.action.sharedUser.SharedUserEditAction" method="delete"> + <result name="error">/WEB-INF/jsp/sharedUserEdit.jsp</result> + <result type="redirectAction">sharedUserView</result> + </action> + </package> + <!-- Fragment: en prevision de faire un peu d'ajax si l'utilisateur le souhaite --> <package name="fragment" namespace="/fragment" extends="restrictedArea"> <action name="editBookmark" class="org.chorem.bow.action.bookmark.EditAction"> diff --git a/bow-ui/src/main/webapp/WEB-INF/jsp/editBookmark.jsp b/bow-ui/src/main/webapp/WEB-INF/jsp/editBookmark.jsp index 8eadad1..f627995 100644 --- a/bow-ui/src/main/webapp/WEB-INF/jsp/editBookmark.jsp +++ b/bow-ui/src/main/webapp/WEB-INF/jsp/editBookmark.jsp @@ -40,6 +40,7 @@ <s:hidden name="tagLine" value="%{tagLine}" /> <s:hidden name="fullTextLine" value="%{fullTextLine}" /> <s:hidden name="bookmarkId" value="%{bookmark.wikittyId}"/> + <s:hidden name="redirectLink" value="%{redirectLink}"/> <s:textfield name="link" labelSeparator=" " key="popup.addurl.link" value="%{bookmark.link}" /> diff --git a/bow-ui/src/main/webapp/WEB-INF/jsp/inc/footer.jsp b/bow-ui/src/main/webapp/WEB-INF/jsp/inc/footer.jsp index b65dcab..0fc62f8 100644 --- a/bow-ui/src/main/webapp/WEB-INF/jsp/inc/footer.jsp +++ b/bow-ui/src/main/webapp/WEB-INF/jsp/inc/footer.jsp @@ -28,7 +28,7 @@ <a shape="rect" href="http://www.chorem.org/projects/show/bow">bow</a> <a shape="rect" href="http://www.chorem.org/projects/bow/files"></a> - <a shape="rect" href="http://www.gnu.org/licenses/agpl.html"><s:text name="bow.footer.license" /></a> - - <span title="Copyright">©2011</span> + <span title="Copyright">©2010-2015</span> <a shape="rect" href="http://www.codelutin.com">Code Lutin</a> - <a shape="rect" href="http://www.chorem.org/projects/bow/issues"><s:text name="bow.footer.bugreport" /></a> - <a shape="rect" href="http://list.chorem.org/cgi-bin/mailman/listinfo/bow-users"><s:text name="bow.footer.userSupport" /></a> - diff --git a/bow-ui/src/main/webapp/WEB-INF/jsp/inc/rightMenu.jsp b/bow-ui/src/main/webapp/WEB-INF/jsp/inc/rightMenu.jsp index 5b6014e..255c79d 100644 --- a/bow-ui/src/main/webapp/WEB-INF/jsp/inc/rightMenu.jsp +++ b/bow-ui/src/main/webapp/WEB-INF/jsp/inc/rightMenu.jsp @@ -27,12 +27,14 @@ <div id="logoutDiv" xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" xmlns:jsp="http://java.sun.com/JSP/Page"> - ${bowSession.user.login} - <s:form action="logout" theme="simple"> - <div class="input"> - <s:submit key="bow.rightMenu.logout" name="submit" /> - </div> - </s:form> + <s:if test="!bowSession.user.extensionNames.contains('BowSharedUser')"> + ${bowSession.user.login} + <s:form action="logout" theme="simple"> + <div class="input"> + <s:submit key="bow.rightMenu.logout" name="submit" /> + </div> + </s:form> + </s:if> <a href="http://maven-site.chorem.org/bow/" class="help" target="_blank"> <s:text name="bow.rightMenu.help" /> </a> @@ -42,23 +44,26 @@ xmlns:jsp="http://java.sun.com/JSP/Page"> <div id="colonneD"> <ul class="droite"> - <s:if test="bowSession.admin"> - <li><s:a action="fragment/callStatistic">CallStatistic</s:a></li> - <li><s:a action="admin"><s:text name="bow.rightMenu.admin" /></s:a></li> - </s:if> - <li><s:a action="preferences"><s:text name="bow.preferences.title" /></s:a></li> - <li> - <s:url var="editBookmark" action="editBookmark" escapeAmp="true"> - <s:param name="tagLine"><s:property value="%{tagLine}" /></s:param> - <s:param name="fullTextLine"><s:property value="%{fullTextLine}" /></s:param> - <s:param name="order" value="%{order}"/> - <s:param name="first" value="%{first}"/> - </s:url> - <s:a href="%{editBookmark}"> - <s:text name="bow.rightMenu.addUrl.link" /> - </s:a> - </li> - <li><s:a action="groupView"><s:text name="bow.groupView.title" /></s:a></li> + <s:if test="!bowSession.user.extensionNames.contains('BowSharedUser')"> + <s:if test="bowSession.admin"> + <li><s:a action="fragment/callStatistic">CallStatistic</s:a></li> + <li><s:a action="admin"><s:text name="bow.rightMenu.admin" /></s:a></li> + </s:if> + <li><s:a action="preferences"><s:text name="bow.preferences.title" /></s:a></li> + <li> + <s:url var="editBookmark" action="editBookmark" escapeAmp="true"> + <s:param name="tagLine"><s:property value="%{tagLine}" /></s:param> + <s:param name="fullTextLine"><s:property value="%{fullTextLine}" /></s:param> + <s:param name="order" value="%{order}"/> + <s:param name="first" value="%{first}"/> + </s:url> + <s:a href="%{editBookmark}"> + <s:text name="bow.rightMenu.addUrl.link" /> + </s:a> + </li> + <li><s:a action="groupView"><s:text name="bow.groupView.title" /></s:a></li> + <li><s:a action="sharedUserView"><s:text name="bow.sharedUserView.title" /></s:a></li> + </s:if> </ul> <!--div id="nuage"--> <jsp:include page="tagsCloud.jsp" flush="true"/> diff --git a/bow-ui/src/main/webapp/WEB-INF/jsp/sharedUserEdit.jsp b/bow-ui/src/main/webapp/WEB-INF/jsp/sharedUserEdit.jsp new file mode 100644 index 0000000..5e0d5e8 --- /dev/null +++ b/bow-ui/src/main/webapp/WEB-INF/jsp/sharedUserEdit.jsp @@ -0,0 +1,62 @@ +<%-- +#%L +bow + +$Id$ +$HeadURL$ +%% +Copyright (C) 2010 -2015 CodeLutin +%% +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 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/>. +#L% +--%> + +<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> +<%@taglib prefix="s" uri="/struts-tags" %> + +<html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" + xmlns:jsp="http://java.sun.com/JSP/Page"> +<head> + <title><s:text name="bow.sharedUserEdit.title"/></title> + <s:url var="css" value="/css/bookmark.css" /> + <link href="${css}" rel="stylesheet" type="text/css"/> + <s:head/> +</head> +<body> + <div id="content"> + <div class="menu clearfix"> + <h2><s:text name="bow.sharedUserEdit.title" /></h2> + </div> + <div class="formFrame fond"> + <s:form id="sharedUserEditForm" cssClass="pretty-form" action="sharedUserSave" + method="post"> + <s:hidden name="tagLine" value="%{tagLine}" /> + <s:hidden name="fullTextLine" value="%{fullTextLine}" /> + <s:hidden name="sharedUserId" value="%{sharedUserId}"/> + <s:hidden name="sharedUser.owner" value="%{sharedUser.owner}"/> + <s:hidden name="sharedUser.permanentToken" value="%{sharedUser.permanentToken}"/> + + <s:textfield disabled="%{sharedUserId != null}" name="sharedUser.login" labelSeparator=" " key="bow.sharedUserEdit.name" + value="%{sharedUser.login}" /> + + <s:textfield name="sharedUser.description" labelSeparator=" " key="bow.sharedUserEdit.description" + value="%{sharedUser.description}" /> + + <s:submit cssClass="submit-button" key="bow.sharedUserEdit.save" name="submit" /> + <s:submit disabled="%{sharedUserId == null}" cssClass="submit-button" key="bow.sharedUserEdit.delete" name="delete" action="sharedUserDelete"/> + </s:form> + </div> + </div> +</body> +</html> diff --git a/bow-ui/src/main/webapp/WEB-INF/jsp/sharedUserView.jsp b/bow-ui/src/main/webapp/WEB-INF/jsp/sharedUserView.jsp new file mode 100644 index 0000000..d92dde8 --- /dev/null +++ b/bow-ui/src/main/webapp/WEB-INF/jsp/sharedUserView.jsp @@ -0,0 +1,77 @@ +<%-- +#%L +bow + +$Id$ +$HeadURL$ +%% +Copyright (C) 2010 CodeLutin +%% +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 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/>. +#L% +--%> + +<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> +<%@taglib prefix="s" uri="/struts-tags" %> +<%@taglib uri="/WEB-INF/bowutils" prefix="u" %> + +<html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" + xmlns:jsp="http://java.sun.com/JSP/Page"> +<head> + <title><s:text name="bow.sharedUserView.title"/></title> + <s:url var="css" value="/css/bookmark.css" /> + <link href="${css}" rel="stylesheet" type="text/css"/> + <s:head/> +</head> +<body> +<div id="content"> + <div class="menu clearfix"> + <h2><s:text name="bow.sharedUserView.title"/></h2> + </div> + <s:actionerror/> + + <div class="formFrame fond"> + <s:a action="sharedUserEdit"><s:text name="bow.sharedUser.new" /></s:a> + <ul> + <s:iterator value="sharedUsers" var="sharedUser"> + <s:set name="sharedUser" value="sharedUser"/> + <li title="${sharedUser.description}"> + <span class="sharedUser-name">${sharedUser.login}</span> + + <span class="sharedUser-actions"> + <s:url var="sharedUserEdit" action="sharedUserEdit" escapeAmp="true"> + <s:param name="sharedUserId" value="%{#sharedUser.wikittyId}" /> + </s:url> + <a class="edit" href="${sharedUserEdit}">edit</a> + + <s:url var="sharedUserDelete" action="sharedUserDelete" escapeAmp="true"> + <s:param name="sharedUserId" value="%{#sharedUser.wikittyId}" /> + </s:url> + <a class="delete" href="${sharedUserDelete}">delete</a> + + <s:url var="atom" action="atom" escapeAmp="true"> + <s:param name="token" value="%{#sharedUser.permanentToken}" /> + <s:param name="tagLine" value="%{'#' + #sharedUser.login}" /> + </s:url> + <a class="atom" href="${atom}">atom</a> + </span> + </li> + </s:iterator> + </ul> + + </div> + +</div> +</body> +</html> diff --git a/bow-ui/src/main/webapp/js/README b/bow-ui/src/main/webapp/js/README new file mode 100644 index 0000000..a5b703a --- /dev/null +++ b/bow-ui/src/main/webapp/js/README @@ -0,0 +1,36 @@ +equivalent en bash du travail de bow +echo -n domain |hmac256 --binary mykey |base64 |sed -re 's/[^a-zA-Z]//g' | sed -re 's/[z]//g' |cut -c-8 |sed -re 's/(.*)/\1;;/g' + +domain: le domain du site +mykey: le mot de passe utilisateur +1 sed: include 'a-zA-Z' +2 sed: exclude 'z' +cut: prend seulement un certain nombre de caractere '8' +3 sed: ajout du suffix ';;' + + +Il faut remplacer: % par %25 dans les bookmarklets + + + + +yamd5-bowpwd.js contient yamd5 (simplifier pour ne supporter que l'ASCII) + script de generation du passwd +yamd5-bowpwd.min.js est la version minifier par http://refresh-sf.com/ +bowpwd-scriptlet.js contient un script d'injection de bowpwd en base64 via la commande: base64 -w0 < yamd5-bowpwd.min.js > yamd5-bowpwd.min.js.b64 + +Le but serait d'avoir: +- yamd5-ascii.js +- bowpwd.js +- scriptlet.js (avec un marqueur a remplacer +et durant la compilation on aggrege, on minimise et on base64 (yamd5-ascii.js + bowpwd.js) que l'on inject dans le template scriptlet.js +pour donner bowpwd-scriptlet.js. Au pire la derniere etape (generation scriplet pourrait etre faite a l'execution par bow) si les autres +etape peuvent etre faite par des plugins maven. + + +Apres test l'injection de script ne fonctionne pas sur tous les sites (ex: +github) ne permet pas l'injection de tag script ou l'origine ne serait pas +celui qu'il a defini. Donc il faut faire + +'javascript:' + yamd5-bowpwd.min.js + +Meme si du coup c'est un peu plus lent diff --git a/bow-ui/src/main/xmi/README b/bow-ui/src/main/xmi/README index 05329c6..9caefd4 100644 --- a/bow-ui/src/main/xmi/README +++ b/bow-ui/src/main/xmi/README @@ -1,2 +1,28 @@ -bow-0.4.zargo data model for bow 0.4 and previous -bow-model.zargo data model for current bow version +BowUser, BowPreference: + BowUser is used for each user with login/passowd and has prefence configuration. + +BowPrefix + BowUser has BowPrefix use to prefix search text and change search behavior + (add, search in tag, search in bookmark, search in specific search engine, + ...) + +BowBookmark, BowImport + BowBookmark is one bookmark, it can be marked imported with extension BowImport + +BowSharedUser + Create by BowUser to share some BowBookmark, this user can't login in + application, and can't modify Bow (preference, bookmark, group, ...) + login is prefixed with wikittyId of creator (BowUser). + if tag is added with prefix '#' this tag reference BowSharedUser + and this BowSharedUser must be in reader of this BowBookmark. + +BowGroup + BowGroup is used to share Bookmark with other BowUser + if tag is added with prefix '@' this tag reference BowGroup + and this BowGroup must be in reader of this BowBookmark. + +BowAuthentication + BowAuthentication is used to define configuration to generate + password for specific BowBookmark. BowAuthentication and BowBookmark have + different WikittyAuthorisation to permit read access to BowBookmark but + not to BowAuthentication. diff --git a/bow-ui/src/main/xmi/bow-model.properties b/bow-ui/src/main/xmi/bow-model.properties new file mode 100644 index 0000000..3163fcd --- /dev/null +++ b/bow-ui/src/main/xmi/bow-model.properties @@ -0,0 +1,2 @@ +org.chorem.bow.BowUser.class.tagvalue.preload=BowUser.bowAuthentication +org.chorem.bow.BowBookmark.class.tagvalue.preload=BowBookmark.bowAuthentication diff --git a/bow-ui/src/main/xmi/bow-model.zargo b/bow-ui/src/main/xmi/bow-model.zargo index 6102526..9a22b10 100644 Binary files a/bow-ui/src/main/xmi/bow-model.zargo and b/bow-ui/src/main/xmi/bow-model.zargo differ -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.