Fossil SCM
Add missing Attach submenu to wiki pages. Fix broken permissions logic in attach_user_may().
Commit
1f49b393745d32ba6918d5ed9879d4a7e21a96a26b8206768271ce1878584b90
Parent
032d684d9b94e18…
2 files changed
+2
-2
+4
+2
-2
| --- src/attach.c | ||
| +++ src/attach.c | ||
| @@ -73,13 +73,13 @@ | ||
| 73 | 73 | if( !login_is_individual() ) return 0; |
| 74 | 74 | switch(iArtifactType){ |
| 75 | 75 | case CFTYPE_FORUM: |
| 76 | 76 | return forumpost_is_owner(rid, 0); |
| 77 | 77 | case CFTYPE_WIKI: |
| 78 | - return g.perm.ApndWiki && g.perm.Attach==0; | |
| 78 | + return g.perm.ApndWiki && g.perm.Attach; | |
| 79 | 79 | case CFTYPE_TICKET: |
| 80 | - return g.perm.ApndTkt && g.perm.Attach==0; | |
| 80 | + return g.perm.ApndTkt && g.perm.Attach; | |
| 81 | 81 | case CFTYPE_EVENT: |
| 82 | 82 | return g.perm.Write && g.perm.ApndWiki && g.perm.Attach; |
| 83 | 83 | default: |
| 84 | 84 | return 0; |
| 85 | 85 | } |
| 86 | 86 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -73,13 +73,13 @@ | |
| 73 | if( !login_is_individual() ) return 0; |
| 74 | switch(iArtifactType){ |
| 75 | case CFTYPE_FORUM: |
| 76 | return forumpost_is_owner(rid, 0); |
| 77 | case CFTYPE_WIKI: |
| 78 | return g.perm.ApndWiki && g.perm.Attach==0; |
| 79 | case CFTYPE_TICKET: |
| 80 | return g.perm.ApndTkt && g.perm.Attach==0; |
| 81 | case CFTYPE_EVENT: |
| 82 | return g.perm.Write && g.perm.ApndWiki && g.perm.Attach; |
| 83 | default: |
| 84 | return 0; |
| 85 | } |
| 86 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -73,13 +73,13 @@ | |
| 73 | if( !login_is_individual() ) return 0; |
| 74 | switch(iArtifactType){ |
| 75 | case CFTYPE_FORUM: |
| 76 | return forumpost_is_owner(rid, 0); |
| 77 | case CFTYPE_WIKI: |
| 78 | return g.perm.ApndWiki && g.perm.Attach; |
| 79 | case CFTYPE_TICKET: |
| 80 | return g.perm.ApndTkt && g.perm.Attach; |
| 81 | case CFTYPE_EVENT: |
| 82 | return g.perm.Write && g.perm.ApndWiki && g.perm.Attach; |
| 83 | default: |
| 84 | return 0; |
| 85 | } |
| 86 |
+4
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -625,10 +625,14 @@ | ||
| 625 | 625 | }else if( rid && g.perm.ApndWiki ){ |
| 626 | 626 | style_submenu_element("Edit", "%R/wikiappend?name=%T", zPageName); |
| 627 | 627 | } |
| 628 | 628 | if( g.perm.Hyperlink ){ |
| 629 | 629 | style_submenu_element("History", "%R/whistory?name=%T", zPageName); |
| 630 | + } | |
| 631 | + if( rid>0 && attach_user_may(rid, CFTYPE_WIKI) ){ | |
| 632 | + style_submenu_element("Attach", "%R/attachadd?target=%T", | |
| 633 | + zPageName); | |
| 630 | 634 | } |
| 631 | 635 | } |
| 632 | 636 | if( !isPopup ){ |
| 633 | 637 | style_set_current_page("%T?name=%T", g.zPath, zPageName); |
| 634 | 638 | wiki_page_header(WIKITYPE_UNKNOWN, zPageName, ""); |
| 635 | 639 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -625,10 +625,14 @@ | |
| 625 | }else if( rid && g.perm.ApndWiki ){ |
| 626 | style_submenu_element("Edit", "%R/wikiappend?name=%T", zPageName); |
| 627 | } |
| 628 | if( g.perm.Hyperlink ){ |
| 629 | style_submenu_element("History", "%R/whistory?name=%T", zPageName); |
| 630 | } |
| 631 | } |
| 632 | if( !isPopup ){ |
| 633 | style_set_current_page("%T?name=%T", g.zPath, zPageName); |
| 634 | wiki_page_header(WIKITYPE_UNKNOWN, zPageName, ""); |
| 635 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -625,10 +625,14 @@ | |
| 625 | }else if( rid && g.perm.ApndWiki ){ |
| 626 | style_submenu_element("Edit", "%R/wikiappend?name=%T", zPageName); |
| 627 | } |
| 628 | if( g.perm.Hyperlink ){ |
| 629 | style_submenu_element("History", "%R/whistory?name=%T", zPageName); |
| 630 | } |
| 631 | if( rid>0 && attach_user_may(rid, CFTYPE_WIKI) ){ |
| 632 | style_submenu_element("Attach", "%R/attachadd?target=%T", |
| 633 | zPageName); |
| 634 | } |
| 635 | } |
| 636 | if( !isPopup ){ |
| 637 | style_set_current_page("%T?name=%T", g.zPath, zPageName); |
| 638 | wiki_page_header(WIKITYPE_UNKNOWN, zPageName, ""); |
| 639 |