https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292018-06-18T16:42:42ZRedmineRedmine - Feature #29048: Wiki page permission levelhttps://www.redmine.org/issues/29048?journal_id=856442018-06-18T16:42:42Zfilippo mandelli
<ul></ul><p>User with lover level will see pages of high level and not vice versa</p> Redmine - Feature #29048: Wiki page permission levelhttps://www.redmine.org/issues/29048?journal_id=856462018-06-18T19:36:49ZGregor Schmidtschmidt@nach-vorne.eu
<ul></ul><p>Did you consider using multiple projects and cross-project wiki links?</p> Redmine - Feature #29048: Wiki page permission levelhttps://www.redmine.org/issues/29048?journal_id=856642018-06-19T09:16:47Zfilippo mandelli
<ul></ul><p>Gregor Schmidt wrote:</p>
<blockquote>
<p>Did you consider using multiple projects and cross-project wiki links?</p>
</blockquote>
<p>It can be a solution but I have lot of project active and in some cases I have only few pages to lock, then I will have so many project to manage only for wiki page access.</p>
<p>In my solution I think it is just a field to add in wiki table and then manage the view. I think it can be done by a plug-in like "Manage Page Permission Plugin"</p> Redmine - Feature #29048: Wiki page permission levelhttps://www.redmine.org/issues/29048?journal_id=856752018-06-20T03:27:29ZBernhard Rohloff
<ul></ul><p>Or maybe you can make it work with custom macros where the text is only shown for a specific role in your project.</p> Redmine - Feature #29048: Wiki page permission levelhttps://www.redmine.org/issues/29048?journal_id=856762018-06-20T06:19:52Zfilippo mandelli
<ul></ul><p>Bernhard Rohloff wrote:</p>
<blockquote>
<p>Or maybe you can make it work with custom macros where the text is only shown for a specific role in your project.</p>
</blockquote>
<p>This should be a very simple solution, but I have questions (I'm not expert in ruby):<br />1 How can I check role<br />2 How can I hide the text</p>
<p>thanks</p> Redmine - Feature #29048: Wiki page permission levelhttps://www.redmine.org/issues/29048?journal_id=856792018-06-20T10:08:39Zfilippo mandelli
<ul></ul><p>filippo mandelli wrote:</p>
<blockquote>
<p>Bernhard Rohloff wrote:</p>
<blockquote>
<p>Or maybe you can make it work with custom macros where the text is only shown for a specific role in your project.</p>
</blockquote>
<p>This should be a very simple solution, but I have questions (I'm not expert in ruby):<br />1 How can I check role<br />2 How can I hide the text</p>
<p>thanks</p>
</blockquote>
<p>I would like to write something to hide page in function of user role:</p>
<pre>
Redmine::WikiFormatting::Macros.register do
desc "Hide page !{{hide(roleToHide)}}"
macro :hide do |obj, args|
.......
end
end
</pre>
<p>Is it possible?</p> Redmine - Feature #29048: Wiki page permission levelhttps://www.redmine.org/issues/29048?journal_id=856802018-06-20T12:59:39ZBernhard Rohloff
<ul></ul><p>Yes, something like this should be possible. If you need some help, I'll try to come up with a solution until tomorrow.</p> Redmine - Feature #29048: Wiki page permission levelhttps://www.redmine.org/issues/29048?journal_id=856812018-06-20T13:53:21Zfilippo mandelli
<ul></ul><p>Bernhard Rohloff wrote:</p>
<blockquote>
<p>Yes, something like this should be possible. If you need some help, I'll try to come up with a solution until tomorrow.</p>
</blockquote>
<p>yes, thank you</p> Redmine - Feature #29048: Wiki page permission levelhttps://www.redmine.org/issues/29048?journal_id=857172018-06-21T11:21:10ZBernhard Rohloff
<ul><li><strong>File</strong> <a href="/attachments/20932">restrict_access_macro.rb</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/20932/restrict_access_macro.rb">restrict_access_macro.rb</a> added</li></ul><p>As I promised yesterday, here is my macro based attempt.</p>
<p><a class="user active" href="https://www.redmine.org/users/431435">Filippo Bernante</a> mandelli <br />Currently it does exact the opposite of your required behavior as it shows content to a specific role rather then hiding it.<br />But I think you can easily modify it to do so by swapping the outputs in the if else block.<br />The error messages are only for demonstration and testing. If you don't need them, just delete the content of the string so that you get:<br /><pre>
out = h("")
</pre></p> Redmine - Feature #29048: Wiki page permission levelhttps://www.redmine.org/issues/29048?journal_id=857202018-06-21T17:07:38Zfilippo mandelli
<ul></ul><p>Grat thanks for your help, I'm testing a wiki page like this:</p>
<hr />
<p>{{restrict_access(1,2,4)}}</p>
<p><strong>Documentation</strong></p>
<p>bla bla</p>
<p>macro</p>
<p>pictures</p>
<hr />
<p>And I would like to hide all lines after the macro {{restrict_access(1,2,4)}} but seems it is not working, maibe I make some error?<br />Can you help me?<br />Thanks again</p> Redmine - Feature #29048: Wiki page permission levelhttps://www.redmine.org/issues/29048?journal_id=857292018-06-22T03:29:08ZBernhard Rohloff
<ul></ul><p>You have to put the text which should be hidden inside the curly brackets.<br />So for example:<br /><pre>
This part should be visible for everybody.
...
{{restrict_access(1,2,4)
But this is only visisble for Managers, Developers and Helpdesk...
}}
...
Here comes normal text again...
</pre></p> Redmine - Feature #29048: Wiki page permission levelhttps://www.redmine.org/issues/29048?journal_id=857332018-06-22T06:44:48Zfilippo mandelli
<ul></ul><p>Ok, I understand</p>
<p>I found two small problem:</p>
<p>1 In case of membership is nill , I fix it in this way</p>
<pre>
if membership.nil?
out = h("Access reserved - no roles")
else
project_roles = membership.roles.to_a
project_roles.map!{ |e| e.id }
matching_roles = project_roles & permitted_roles
if matching_roles.any?
out = h(textilizable(text))
else
out = h("Access reserved - no member")
end
end
</pre>
<p>2 In case I have wiki page that contains macro childpages I have this error, but it is not a problem for my purpose</p>
<pre>
Error executing the child_pages macro (With no argument, this macro can be called from wiki pages only.)
</pre>
<p>Thanks for help</p> Redmine - Feature #29048: Wiki page permission levelhttps://www.redmine.org/issues/29048?journal_id=857342018-06-22T07:02:01Zfilippo mandelli
<ul></ul><p>I add another problem that is critical for me, if wiki page contain image</p>
<pre>
!imageExample.png!
</pre>
<p>it is not visible</p> Redmine - Feature #29048: Wiki page permission levelhttps://www.redmine.org/issues/29048?journal_id=857462018-06-22T11:46:45ZBernhard Rohloff
<ul><li><strong>File</strong> <a href="/attachments/20938">restrict_access_macro_v2.rb</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/20938/restrict_access_macro_v2.rb">restrict_access_macro_v2.rb</a> added</li></ul><p>This is a slightly modified version, which should fix your problems.</p> Redmine - Feature #29048: Wiki page permission levelhttps://www.redmine.org/issues/29048?journal_id=857472018-06-22T12:56:28Zfilippo mandelli
<ul></ul><p>Bernhard Rohloff wrote:</p>
<blockquote>
<p>This is a slightly modified version, which should fix your problems.</p>
</blockquote>
<p>Hello Bernhard, the problem of images is still present in my installation</p>
<p>And I see another small problem: in case I want to hide just a link to an issues inside a line<br /><pre>
{{restrict_access(1,2,4) (#356) }}
</pre></p>
<p>It doesn't run, but I can workaround in this way</p>
<pre>
{{restrict_access2(1,2,4)
(#356)
}}
</pre>
<p>Thanks for your help</p> Redmine - Feature #29048: Wiki page permission levelhttps://www.redmine.org/issues/29048?journal_id=857492018-06-22T14:58:52ZBernhard Rohloff
<ul></ul><p>filippo mandelli wrote:</p>
<blockquote>
<p>Hello Bernhard, the problem of images is still present in my installation</p>
</blockquote>
<p>Hey filippo,</p>
<p>you are logged in with an admin account, aren't you?<br />I've forgotten to apply my changes also for this case. The <a href="https://www.redmine.org/attachments/20938/restrict_access_macro_v2.rb#L22" class="external">line 22</a> should of course be the same as <a href="https://www.redmine.org/attachments/20938/restrict_access_macro_v2.rb#L17" class="external">line 17</a>. Then all should work fine.</p>
<blockquote>
<p>And I see another small problem: in case I want to hide just a link to an issues inside a line<br />[...]</p>
<p>It doesn't run, but I can workaround in this way</p>
<p>[...]</p>
</blockquote>
<p>This seems to be expected behavior according to <a class="wiki-page" href="https://www.redmine.org/projects/redmine/wiki/RedmineMacros#Invoking-macros-in-formatted-text">RedmineMacros</a> in the wiki.</p> Redmine - Feature #29048: Wiki page permission levelhttps://www.redmine.org/issues/29048?journal_id=857502018-06-22T15:19:38Zfilippo mandelli
<ul></ul><p>Ohh yes , thanks again :-)</p>