homeland-wiki 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33c85fe4edab99469bbd84cb946d85b3769a87d1
|
4
|
+
data.tar.gz: ef6028d5cddedb8320de340163defb3b1c23f56c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6a81401716122682d49dd9de3664005bcb632c395f0b94ef46013a59298eca944209521f9566b48976a41f5b258fafb7570c8432c9be83ea935a78531ff7a00
|
7
|
+
data.tar.gz: 725e9074db67ce09237f681ebc846f2eab2a2e2ddfa2ebf06a0700c14d3064ef264d1569094c5be80dc30ec2169268204179a0a2b8eb86968e7d7e651f183934
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Homeland::Wiki
|
2
2
|
class PagesController < Homeland::Wiki::ApplicationController
|
3
3
|
require_module_enabled! :wiki
|
4
|
-
authorize_resource :page
|
5
4
|
before_action :set_page, only: [:show, :edit, :update, :destroy, :comments]
|
6
5
|
|
7
6
|
etag { Setting.wiki_sidebar_html }
|
@@ -35,6 +34,8 @@ module Homeland::Wiki
|
|
35
34
|
end
|
36
35
|
|
37
36
|
def new
|
37
|
+
authorize! :create, Page
|
38
|
+
|
38
39
|
@page = Page.new
|
39
40
|
@page.slug = params[:title]
|
40
41
|
respond_to do |format|
|
@@ -44,9 +45,12 @@ module Homeland::Wiki
|
|
44
45
|
end
|
45
46
|
|
46
47
|
def edit
|
48
|
+
authorize! :edit, @page
|
47
49
|
end
|
48
50
|
|
49
51
|
def create
|
52
|
+
authorize! :create, Page
|
53
|
+
|
50
54
|
@page = Page.new(page_params)
|
51
55
|
@page.user_id = current_user.id
|
52
56
|
@page.version_enable = true
|
@@ -59,6 +63,8 @@ module Homeland::Wiki
|
|
59
63
|
end
|
60
64
|
|
61
65
|
def update
|
66
|
+
authorize! :update, @page
|
67
|
+
|
62
68
|
@page.version_enable = true
|
63
69
|
@page.user_id = current_user.id
|
64
70
|
|
@@ -6,15 +6,21 @@ module Homeland::Wiki
|
|
6
6
|
|
7
7
|
def initialize(u)
|
8
8
|
@user = u
|
9
|
-
|
10
|
-
|
9
|
+
if @user.blank?
|
10
|
+
roles_for_anonymous
|
11
|
+
elsif @user.roles?(:admin)
|
12
|
+
can :manage, Page
|
13
|
+
elsif @user.roles?(:wiki_editor)
|
14
|
+
roles_for_wiki_editor
|
15
|
+
else
|
16
|
+
roles_for_anonymous
|
17
|
+
end
|
11
18
|
end
|
12
19
|
|
13
20
|
protected
|
14
21
|
|
15
|
-
def
|
22
|
+
def roles_for_wiki_editor
|
16
23
|
can :create, Page
|
17
|
-
can :edit, Page, locked: false
|
18
24
|
can :update, Page, locked: false
|
19
25
|
end
|
20
26
|
|