classiccms 0.6.7 → 0.6.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,14 +8,14 @@ module Classiccms
8
8
 
9
9
  #insert the header for CMS to work
10
10
  def cms
11
- if defined? @user
11
+ if @user != nil and @user.admin?
12
12
  show :header, views: File.join(Classiccms::ROOT, 'views/cms')
13
13
  end
14
14
  end
15
15
 
16
16
  #insert the logout button
17
17
  def logout
18
- if @user != nil
18
+ if @user != nil and @user.admin?
19
19
  show :logout, views: File.join(Classiccms::ROOT, 'views/cms')
20
20
  end
21
21
  end
@@ -92,7 +92,7 @@ module Classiccms
92
92
  item[1] = get_parent_id(item[1])
93
93
  end
94
94
  end
95
- if @user != nil
95
+ if @user != nil and @user.admin?
96
96
  info = Base64.encode64(items.to_s.encrypt)
97
97
  show :add, {views: File.join(Classiccms::ROOT, 'views/cms')}, {encrypteddata: info}
98
98
  end
@@ -101,7 +101,7 @@ module Classiccms
101
101
  #returns the html for edit button
102
102
  def edit(id)
103
103
  records = Base.where(_id: id)
104
- if records.count > 0 and @user != nil
104
+ if records.count > 0 and @user != nil and @user.admin?
105
105
  info = Base64.encode64 records.first.id.to_s.encrypt
106
106
 
107
107
  show :edit, {views: File.join(Classiccms::ROOT, 'views/cms')}, {encrypteddata: info}
@@ -113,7 +113,7 @@ module Classiccms
113
113
  if object.kind_of? Moped::BSON::ObjectId or object.kind_of? String
114
114
  object = Base.where(:_id => object).first
115
115
  end
116
- if @user != nil
116
+ if @user != nil and @user.admin?
117
117
  object.id.to_s
118
118
  end
119
119
  end
@@ -0,0 +1,16 @@
1
+ class User
2
+ include Mongoid::Document
3
+
4
+ field :username, type: String
5
+ field :password
6
+
7
+ ##validations
8
+ validates_uniqueness_of :username
9
+ validates_length_of :username, minimum: 3, maximum: 25
10
+ validates_length_of :password, minimum: 3, maximum: 25
11
+
12
+
13
+ def admin?
14
+ return true
15
+ end
16
+ end
@@ -1,3 +1,3 @@
1
1
  module Classiccms #:nodoc
2
- VERSION = "0.6.7"
2
+ VERSION = "0.6.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: classiccms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.7
4
+ version: 0.6.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-09 00:00:00.000000000 Z
12
+ date: 2012-11-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -329,8 +329,6 @@ files:
329
329
  - lib/classiccms/models/connection.rb
330
330
  - lib/classiccms/models/image.rb
331
331
  - lib/classiccms/models/slug.rb
332
- - lib/classiccms/models/uploader.rb
333
- - lib/classiccms/models/user.rb
334
332
  - lib/classiccms/public/admin/bootstrap/css/bootstrap-responsive.css
335
333
  - lib/classiccms/public/admin/bootstrap/css/bootstrap-responsive.min.css
336
334
  - lib/classiccms/public/admin/bootstrap/css/bootstrap.css
@@ -1523,6 +1521,7 @@ files:
1523
1521
  - lib/classiccms/scaffold/Rakefile
1524
1522
  - lib/classiccms/scaffold/app/controllers/form.rb
1525
1523
  - lib/classiccms/scaffold/app/models/Article.rb
1524
+ - lib/classiccms/scaffold/app/models/user.rb
1526
1525
  - lib/classiccms/scaffold/app/queue/mail.rb
1527
1526
  - lib/classiccms/scaffold/app/views/application/index.haml
1528
1527
  - lib/classiccms/scaffold/config.ru
@@ -1,17 +0,0 @@
1
- #require 'carrierwave/mongoid'
2
- #
3
- #class Uploader< CarrierWave::Uploader::Base
4
- # include Mongoid::Document
5
- # #include CarrierWave::RMagick
6
- # storage :file
7
- #
8
- # def filename
9
- # "#{id}.#{file.extension}" if original_filename.present?
10
- # end
11
- # def extension_white_list
12
- # %w(jpg jpeg gif png)
13
- # end
14
- # def store_dir
15
- # File.join(Dir.pwd, 'public/assets/images')
16
- # end
17
- #end
@@ -1,11 +0,0 @@
1
- class User
2
- include Mongoid::Document
3
-
4
- field :username, type: String
5
- field :password
6
-
7
- ##validations
8
- validates_uniqueness_of :username
9
- validates_length_of :username, minimum: 3, maximum: 25
10
- validates_length_of :password, minimum: 3, maximum: 25
11
- end