Hi,
I'm trying to set rights over a document automatically.
In my wiki i have the "Publication" concept. Each Publication has one or
more authors. Each author is an "Researcher" that is directly related to an
XWikiUser. What I want to do is to set editing rights only for the authors
of that publication. If I add (or remove) an author he should be able (not
able) to edit the document.
What i thought first was to check and add user rights every time the
document was loaded. However this didn't worked because, initially, users
don't have rights to add new rights (lol). That doesn't seemed a good
practice anyway.
What is the best way to do this? Maybe after every change in editing mode,
system may apply the rights? How can I do that?
Btw, I'm using this snippet to add the user rights:
http://extensions.xwiki.org/xwiki/bin/view/Extension/Setting+Rights
Thanks in advance,
LuÃs Braga
--
View this message in context: http://xwiki.475771.n2.nabble.com/Dynamically-set-rights-over-document-tp60…
Sent from the XWiki- Dev mailing list archive at Nabble.com.
Hi,
This is probably a newbie question but I didn't find any clear answer for
me.
Could someone explain to me how to use "xpage"? For example, when trying to
modify user avatar this code is used:
$doc.getURL('edit', 'xpage=changemyavatar')
I really don't know how this works or where I can find the piece of code
related to this action.
Thanks,
LuÃs Braga
--
View this message in context: http://xwiki.475771.n2.nabble.com/How-to-use-xpage-tp6056768p6056768.html
Sent from the XWiki- Dev mailing list archive at Nabble.com.
Hi Thomas,
I think it could be a good idea to remove (deprecate?) the current BlockFilter interface/implementations and instead use the newly introduced BlockMatcher. WDYT?
Thanks
-Vincent
On Sat, Feb 19, 2011 at 10:38, vmassol <platform-notifications(a)xwiki.org> wrote:
> Author: vmassol
> Date: 2011-02-19 10:38:37 +0100 (Sat, 19 Feb 2011)
> New Revision: 34808
>
> Added:
> Â platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/block/match/CompositeBlockMatcher.java
> Modified:
> Â platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-include/src/main/java/org/xwiki/rendering/internal/macro/include/IncludeMacro.java
> Log:
> XWIKI-1776: Support Include of Section Content
>
> * Added javadoc
> * Introduced CompositeBlockMatcher
>
> Added: platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/block/match/CompositeBlockMatcher.java
> ===================================================================
> --- platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/block/match/CompositeBlockMatcher.java               (rev 0)
> +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/block/match/CompositeBlockMatcher.java   2011-02-19 09:38:37 UTC (rev 34808)
> @@ -0,0 +1,72 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software 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
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package org.xwiki.rendering.block.match;
> +
> +import java.util.ArrayList;
> +import java.util.List;
> +
> +import org.xwiki.rendering.block.Block;
> +
> +/**
> + * Implementation of {@link BlockMatcher} which matches blocks using passed matchers in series.
> + *
> + * @version $Id$
> + * @since 3.0M3
> + */
> +public class CompositeBlockMatcher implements BlockMatcher
> +{
> + Â Â /**
> + Â Â * The matchers to match in series.
> + Â Â */
> + Â Â private List<BlockMatcher> matchers = new ArrayList<BlockMatcher>();
> +
> + Â Â /**
> + Â Â * @param matchers list of matchers to add
> + Â Â */
> + Â Â public CompositeBlockMatcher(List<BlockMatcher> matchers)
> + Â Â {
> + Â Â Â Â this.matchers.addAll(matchers);
> + Â Â }
> +
> + Â Â /**
> + Â Â * @param matchers vararg list of matchers to add
> + Â Â */
> + Â Â public CompositeBlockMatcher(BlockMatcher... matchers)
> + Â Â {
> + Â Â Â Â for (BlockMatcher matcher : matchers) {
> + Â Â Â Â Â Â this.matchers.add(matcher);
> + Â Â Â Â }
> + Â Â }
> +
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â *
> + Â Â * @see org.xwiki.rendering.block.match.BlockMatcher#match(org.xwiki.rendering.block.Block)
> + Â Â */
> + Â Â public boolean match(Block block)
> + Â Â {
> + Â Â Â Â for (BlockMatcher matcher : this.matchers) {
> + Â Â Â Â Â Â if (!matcher.match(block)) {
> + Â Â Â Â Â Â Â Â return false;
> + Â Â Â Â Â Â }
> + Â Â Â Â }
> + Â Â Â Â return true;
> + Â Â }
> +}
>
> Modified: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-include/src/main/java/org/xwiki/rendering/internal/macro/include/IncludeMacro.java
> ===================================================================
> --- platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-include/src/main/java/org/xwiki/rendering/internal/macro/include/IncludeMacro.java 2011-02-18 22:26:41 UTC (rev 34807)
> +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-include/src/main/java/org/xwiki/rendering/internal/macro/include/IncludeMacro.java 2011-02-19 09:38:37 UTC (rev 34808)
> @@ -41,6 +41,8 @@
> Â import org.xwiki.rendering.block.MetaDataBlock;
> Â import org.xwiki.rendering.block.XDOM;
> Â import org.xwiki.rendering.block.match.BlockMatcher;
> +import org.xwiki.rendering.block.match.ClassBlockMatcher;
> +import org.xwiki.rendering.block.match.CompositeBlockMatcher;
> Â import org.xwiki.rendering.internal.macro.MacroContentParser;
> Â import org.xwiki.rendering.listener.MetaData;
> Â import org.xwiki.rendering.macro.AbstractMacro;
> @@ -207,24 +209,33 @@
> Â Â Â Â return result;
> Â Â }
>
> + Â Â /**
> + Â Â * Get the content to include (either full target document or a specific section's content).
> + Â Â *
> + Â Â * @param document the reference to the document from which to get the content
> + Â Â * @param section the id of the section from which to get the content in that document or null to take the whole
> + Â Â * Â Â Â Â content
> + Â Â * @param includedReference the resolved absolute reference of the included document
> + Â Â * @return the content as an XDOM tree
> + Â Â * @throws MacroExecutionException if no section of the passed if exists in the included document
> + Â Â */
> Â Â private XDOM getContent(DocumentModelBridge document, final String section, DocumentReference includedReference)
> Â Â Â Â throws MacroExecutionException
> Â Â {
> Â Â Â Â XDOM includedContent = document.getXDOM();
>
> Â Â Â Â if (section != null) {
> - Â Â Â Â Â Â HeaderBlock headerBlock = (HeaderBlock) includedContent.getFirstBlock(new BlockMatcher() {
> - Â Â Â Â Â Â Â Â public boolean match(Block block)
> - Â Â Â Â Â Â Â Â {
> - Â Â Â Â Â Â Â Â Â Â if (block instanceof HeaderBlock) {
> + Â Â Â Â Â Â HeaderBlock headerBlock = (HeaderBlock) includedContent.getFirstBlock(
> + Â Â Â Â Â Â Â Â new CompositeBlockMatcher(new ClassBlockMatcher(HeaderBlock.class), new BlockMatcher() {
> + Â Â Â Â Â Â Â Â Â Â public boolean match(Block block)
> + Â Â Â Â Â Â Â Â Â Â {
> Â Â Â Â Â Â Â Â Â Â Â Â HeaderBlock headerBlock = (HeaderBlock) block;
> Â Â Â Â Â Â Â Â Â Â Â Â if (headerBlock.getId().equals(section)) {
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â return true;
> Â Â Â Â Â Â Â Â Â Â Â Â }
> + Â Â Â Â Â Â Â Â Â Â Â Â return false;
What about
return headerBlock.getId().equals(section);
?
> Â Â Â Â Â Â Â Â Â Â }
> - Â Â Â Â Â Â Â Â Â Â return false;
> - Â Â Â Â Â Â Â Â }
> - Â Â Â Â Â Â }, Block.Axes.DESCENDANT);
> + Â Â Â Â Â Â Â Â }),Block.Axes.DESCENDANT);
> Â Â Â Â Â Â if (headerBlock == null) {
> Â Â Â Â Â Â Â Â throw new MacroExecutionException("Cannot find section [" + section
> Â Â Â Â Â Â Â Â Â Â + "] in document [" + this.defaultEntityReferenceSerializer.serialize(includedReference) + "]");
> @@ -291,19 +302,26 @@
> Â Â {
> Â Â Â Â DocumentReference result;
>
> - Â Â Â Â String sourceMetadata = null;
> - Â Â Â Â MetaDataBlock metadataBlock = block.getPreviousBlockByType(MetaDataBlock.class, true);
> - Â Â Â Â while (sourceMetadata == null && metadataBlock != null) {
> - Â Â Â Â Â Â sourceMetadata = (String) metadataBlock.getMetaData().getMetaData(MetaData.SOURCE);
> - Â Â Â Â Â Â metadataBlock = metadataBlock.getPreviousBlockByType(MetaDataBlock.class, true);
> - Â Â Â Â }
> + Â Â Â Â MetaDataBlock metaDataBlock = (MetaDataBlock) block.getFirstBlock(
> + Â Â Â Â Â Â new CompositeBlockMatcher(new ClassBlockMatcher(MetaDataBlock.class), new BlockMatcher() {
> + Â Â Â Â Â Â Â Â public boolean match(Block block)
> + Â Â Â Â Â Â Â Â {
> + Â Â Â Â Â Â Â Â Â Â MetaDataBlock metaDataBlock = (MetaDataBlock) block;
> + Â Â Â Â Â Â Â Â Â Â String sourceMetaData = (String) metaDataBlock.getMetaData().getMetaData(MetaData.SOURCE);
> + Â Â Â Â Â Â Â Â Â Â if (sourceMetaData != null) {
> + Â Â Â Â Â Â Â Â Â Â Â Â return true;
> + Â Â Â Â Â Â Â Â Â Â }
> + Â Â Â Â Â Â Â Â Â Â return false;
Maybe we should add something like MetaDataBlock#contains(String key) method.
> + Â Â Â Â Â Â Â Â }
> + Â Â Â Â Â Â }), Block.Axes.ANCESTOR);
>
> Â Â Â Â // If no Source MetaData was found resolve against the current document as a failsafe solution.
> - Â Â Â Â if (sourceMetadata == null) {
> + Â Â Â Â if (metaDataBlock == null) {
> Â Â Â Â Â Â result = this.currentDocumentReferenceResolver.resolve(documentName);
> Â Â Â Â } else {
> + Â Â Â Â Â Â String sourceMetaData = (String) metaDataBlock.getMetaData().getMetaData(MetaData.SOURCE);
> Â Â Â Â Â Â result = this.currentDocumentReferenceResolver.resolve(documentName,
> - Â Â Â Â Â Â Â Â this.currentDocumentReferenceResolver.resolve(sourceMetadata));
> + Â Â Â Â Â Â Â Â this.currentDocumentReferenceResolver.resolve(sourceMetaData));
> Â Â Â Â }
>
> Â Â Â Â return result;
>
> _______________________________________________
> notifications mailing list
> notifications(a)xwiki.org
> http://lists.xwiki.org/mailman/listinfo/notifications
>
--
Thomas Mortagne
Hi,
Just a notice that I'll remove the following branches from jira since we (open source xwiki developers) only support 2 branches (trunk + latest stable):
• xwiki-core-1.5-curriki/
• xwiki-core-1.8/
• xwiki-core-1.9/
• xwiki-core-2.1/
• xwiki-core-2.2/
• xwiki-core-2.3/
• xwiki-core-2.4/
Please shout quickly if you have a good reason to keep one of these (also note that they'll always be in the svn history).
Thanks
-Vincent
Hi,
Would be very nice to have a development wiki in order to get things going
on the new XWiki.org proposal:
http://incubator.myxwiki.org/xwiki/bin/view/Improvements/XWikiOrgProposal2
Maybe Vincent can help with this? :)
Since the redesign is quite big and lots of spaces|panels|styles need to be
changed, morphing the current xwiki.org on the go would be quite difficult.
So, having the development wiki would be much easier to work decentralized
on different parts of it when people have time.
There are lot of areas of the proposal that are not covered and would be
really great to receive proposals and help from other members of the
community.
Also the implementation needs volunteers :) so any help is appreciated. We
will also use the new xwiki.org logo proposed by the community, so having
all this ideas come together and be put into action is very exciting.
Thanks for the support,
Caty
Resources:
- Original Proposal mail: http://markmail.org/message/4erqdhwuzvmtts6p
- Logo Challenge mail: http://markmail.org/thread/bze35tdm4iojnafa
Hi guys,
I've taken the liberty to refine the notion of active committer on http://dev.xwiki.org/xwiki/bin/view/Community/Committership
Basically the idea is that active means having at least 1 commit in a period of 1 year (rolling period).
We had discussed this and it was hinted in the text I rewrote.
Just wanted to make sure we all agree about it.
This notion can be useful on:
* the hall of fame page
* the new download page where companies can list their number of active committers
Thanks
-Vincent