adminaccess 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/adminaccess.rb +43 -0
- metadata +47 -0
data/lib/adminaccess.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
module AdminAccess
|
2
|
+
def auth(myAdmin, doc, file)
|
3
|
+
if myAdmin==true
|
4
|
+
if doc=="new" || doc=="edit"
|
5
|
+
respond_to do |format|
|
6
|
+
format.html # show.html.erb
|
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
|
38
|
+
else
|
39
|
+
render :file => file, :status =>404
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: adminaccess
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Roisin Kelly
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-03-24 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: This gem controls access to create, update, delete, new functions within
|
15
|
+
a rails project
|
16
|
+
email: Roisin.kelly@gmx.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- lib/adminaccess.rb
|
22
|
+
homepage: http://rubygems.org/gems/adminaccess
|
23
|
+
licenses: []
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
none: false
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 1.8.25
|
43
|
+
signing_key:
|
44
|
+
specification_version: 3
|
45
|
+
summary: This gem controls access to create, update, delete, new functions within
|
46
|
+
a rails project
|
47
|
+
test_files: []
|