adminaccess 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/adminaccess.rb +5 -35
- metadata +1 -1
data/lib/adminaccess.rb
CHANGED
@@ -1,42 +1,12 @@
|
|
1
1
|
module AdminAccess
|
2
|
-
|
2
|
+
def self.auth(myAdmin, file)
|
3
3
|
if myAdmin==true
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
format.json { render json: @article }
|
8
|
-
end
|
9
|
-
elsif doc=="create"
|
10
|
-
respond_to do |format|
|
11
|
-
if @article.save
|
12
|
-
format.html { redirect_to @article, notice: 'Article was successfully created.' }
|
13
|
-
format.json { render json: @article, status: :created, location: @article }
|
14
|
-
else
|
15
|
-
format.html { render action: "new" }
|
16
|
-
format.json { render json: @article.errors, status: :unprocessable_entity }
|
17
|
-
end
|
18
|
-
end
|
19
|
-
elsif doc=="update"
|
20
|
-
respond_to do |format|
|
21
|
-
if @article.update_attributes(params[:article])
|
22
|
-
format.html { redirect_to @article, notice: 'Article was successfully updated.' }
|
23
|
-
format.json { head :no_content }
|
24
|
-
else
|
25
|
-
format.html { render action: "edit" }
|
26
|
-
format.json { render json: @article.errors, status: :unprocessable_entity }
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
else
|
31
|
-
@article.destroy
|
32
|
-
|
33
|
-
respond_to do |format|
|
34
|
-
format.html { redirect_to articles_url }
|
35
|
-
format.json { head :no_content }
|
36
|
-
end
|
37
|
-
end
|
4
|
+
|
5
|
+
return true
|
6
|
+
|
38
7
|
else
|
39
8
|
render :file => file, :status =>404
|
9
|
+
return false
|
40
10
|
|
41
11
|
end
|
42
12
|
end
|