drg_cms 0.4.39 → 0.4.53

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +49 -0
  3. data/app/assets/images/drg_cms/file_manager.png +0 -0
  4. data/app/assets/javascripts/drg_cms/drg_cms.js +8 -8
  5. data/app/assets/stylesheets/drg_cms/drg_cms.css +22 -20
  6. data/app/controllers/cmsedit_controller.rb +170 -114
  7. data/app/controllers/dc_application_controller.rb +142 -56
  8. data/app/controllers/dc_common_controller.rb +56 -34
  9. data/app/controllers/dc_main_controller.rb +1 -4
  10. data/app/controllers/drgcms_controls/dc_page_controls.rb +3 -0
  11. data/app/forms/all_options.yml +3 -0
  12. data/app/forms/cms_menu.yml +100 -117
  13. data/app/forms/dc_design.yml +1 -1
  14. data/app/forms/dc_ident.yml +37 -0
  15. data/app/forms/dc_menu_item.yml +1 -1
  16. data/app/forms/dc_permission.yml +1 -1
  17. data/app/forms/dc_site.yml +4 -0
  18. data/app/helpers/cmsedit_helper.rb +44 -80
  19. data/app/helpers/dc_ad_renderer.rb +27 -15
  20. data/app/helpers/dc_application_helper.rb +433 -196
  21. data/app/helpers/dc_big_menu_renderer.rb +40 -40
  22. data/app/helpers/dc_captcha_renderer.rb +38 -25
  23. data/app/helpers/dc_common_renderer.rb +15 -48
  24. data/app/helpers/dc_menu_renderer.rb +30 -20
  25. data/app/helpers/dc_page_renderer.rb +14 -18
  26. data/app/helpers/dc_part_renderer.rb +45 -16
  27. data/app/helpers/dc_piece_renderer.rb +23 -29
  28. data/app/helpers/dc_poll_renderer.rb +31 -20
  29. data/app/helpers/dc_renderer.rb +5 -4
  30. data/app/helpers/dc_simple_menu_renderer.rb +90 -68
  31. data/app/models/{__dc_global_data.rb → __dc_stat.rb} +20 -21
  32. data/app/models/dc_ad.rb +13 -1
  33. data/app/models/dc_ad_stat.rb +6 -0
  34. data/app/models/dc_big_menu.rb +15 -2
  35. data/app/models/dc_big_table.rb +27 -4
  36. data/app/models/dc_big_table_locale.rb +7 -0
  37. data/app/models/dc_big_table_value.rb +7 -0
  38. data/app/models/dc_category.rb +9 -3
  39. data/app/models/dc_design.rb +50 -0
  40. data/app/models/dc_dummy.rb +41 -1
  41. data/app/models/dc_folder_permission.rb +9 -2
  42. data/app/models/{dc_global_data.rb → dc_ident.rb} +20 -22
  43. data/app/models/dc_journal.rb +9 -1
  44. data/app/models/dc_key_value_store.rb +41 -4
  45. data/app/models/dc_link.rb +7 -0
  46. data/app/models/dc_menu.rb +20 -3
  47. data/app/models/dc_menu_item.rb +7 -0
  48. data/app/models/dc_page.rb +31 -12
  49. data/app/models/dc_part.rb +34 -4
  50. data/app/models/dc_permission.rb +32 -12
  51. data/app/models/dc_piece.rb +32 -4
  52. data/app/models/dc_policy.rb +17 -11
  53. data/app/models/dc_policy_role.rb +12 -7
  54. data/app/models/dc_policy_rule.rb +32 -4
  55. data/app/models/dc_poll.rb +8 -0
  56. data/app/models/dc_poll_item.rb +6 -0
  57. data/app/models/dc_simple_menu.rb +18 -3
  58. data/app/models/dc_simple_menu_item.rb +20 -2
  59. data/app/models/dc_site.rb +13 -3
  60. data/app/models/dc_stat.rb +8 -1
  61. data/app/models/dc_user.rb +18 -2
  62. data/app/models/dc_user_role.rb +7 -0
  63. data/app/models/dc_visit.rb +5 -0
  64. data/app/{helpers → models}/drgcms_form_field.rb +171 -73
  65. data/app/views/__dc_at_the_beginning/create.html.erb +9 -0
  66. data/app/views/__dc_at_the_beginning/index.html.erb +19 -0
  67. data/app/views/cmsedit/_edit_stuff.html.erb +2 -0
  68. data/app/views/cmsedit/_form.html.erb +0 -1
  69. data/app/views/dc_mail/subscribe.html.erb +0 -0
  70. data/config/initializers/kaminari_patch.rb +5 -4
  71. data/config/locales/drgcms_en.yml +4 -0
  72. data/config/locales/drgcms_sl.yml +1 -0
  73. data/config/locales/models_en.yml +14 -3
  74. data/config/locales/models_sl.yml +13 -4
  75. data/drg_cms.gemspec +4 -4
  76. data/lib/drg_cms.rb +37 -8
  77. data/lib/drg_cms/engine.rb +2 -2
  78. data/lib/drg_cms/version.rb +3 -2
  79. data/lib/tasks/at_the_beginning.yml +0 -0
  80. data/lib/tasks/dc_at_the_beginning.rake +118 -0
  81. data/lib/tasks/dc_cleanup.rake +19 -7
  82. data/lib/tasks/log_statistics.rb +66 -0
  83. data/lib/tasks/site_statistics.rake +29 -12
  84. data/test/dummy/app/controllers/application_controller.rb +1 -1
  85. data/test/dummy/app/helpers/application_helper.rb +1 -1
  86. metadata +15 -26
  87. data/README.rdoc +0 -3
  88. data/app/controllers/dc_at_the_beginning_controller.rb +0 -120
  89. data/app/controllers/dc_mail_controller.rb +0 -89
  90. data/app/forms/dc_forum_cat.yml +0 -54
  91. data/app/forms/dc_forum_forum.yml +0 -53
  92. data/app/forms/dc_forum_msg.yml +0 -124
  93. data/app/forms/dc_forum_privmsg.yml +0 -125
  94. data/app/forms/dc_forum_topic.yml +0 -131
  95. data/app/forms/dc_mail.yml +0 -88
  96. data/app/forms/dc_mail_address.yml +0 -56
  97. data/app/forms/dc_mail_list.yml +0 -44
  98. data/app/forms/dc_mail_list_member.yml +0 -42
  99. data/app/helpers/dc_mail_renderer.rb +0 -76
  100. data/app/models/dc_mail.rb +0 -64
  101. data/app/models/dc_mail_address.rb +0 -69
  102. data/app/models/dc_mail_list.rb +0 -48
  103. data/app/models/dc_mail_list_member.rb +0 -34
  104. data/app/models/dc_sendmail.rb +0 -48
@@ -21,6 +21,15 @@
21
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  #++
23
23
 
24
+ #########################################################################
25
+ # Mongoid::Document model for dc_key_value_stores collection.
26
+ #
27
+ # This model represents key/value store. Typical usage is for saving last
28
+ # used document number on some internal document numbering schema.
29
+ #
30
+ # Example:
31
+ # doc_number = DcKeyValueStore.get_next_value('invoices', invoice_date.year)
32
+ #########################################################################
24
33
  class DcKeyValueStore
25
34
  include Mongoid::Document
26
35
 
@@ -31,6 +40,12 @@ class DcKeyValueStore
31
40
 
32
41
  ###########################################################################
33
42
  # Will return value incremented by 1 and update document with new value.
43
+ #
44
+ # Parameters:
45
+ # [keys] Array. Any number of parameters from which key will be generated.
46
+ #
47
+ # Returns:
48
+ # String. Last saved value incremented by 1.
34
49
  ###########################################################################
35
50
  def self.get_next_value(*keys)
36
51
  doc = find_by(key: keys.join('-'))
@@ -46,8 +61,12 @@ end
46
61
 
47
62
  ###########################################################################
48
63
  # Will try to restore to previous value if value is not already incremented.
64
+ #
65
+ # Parameters:
66
+ # [value] String. Last value obtained by get_next_value method.
67
+ # [keys] Array. Any number of parameters from which key will be generated.
49
68
  ###########################################################################
50
- def self.restore_value(value,*keys)
69
+ def self.restore_value(value, *keys)
51
70
  doc = find_by(key: keys.join('-'))
52
71
  if value == doc.value
53
72
  value = (value.to_i - 1).to_s
@@ -59,7 +78,15 @@ def self.restore_value(value,*keys)
59
78
  end
60
79
 
61
80
  ###########################################################################
62
- #
81
+ # Will return value incremented by 1 but will not update document with new value.
82
+ # Used for presenting user with most possible document number. Real document number must
83
+ # of course be obtained by get_next_value before document is saved to collection.
84
+ #
85
+ # Parameters:
86
+ # [keys] Array. Any number of parameters from which key will be generated.
87
+ #
88
+ # Returns:
89
+ # String. Last saved value incremented by 1.
63
90
  ###########################################################################
64
91
  def self.peep_next_value(*keys)
65
92
  doc = find_by(key: keys.join('-'))
@@ -67,7 +94,13 @@ def self.peep_next_value(*keys)
67
94
  end
68
95
 
69
96
  ###########################################################################
70
- #
97
+ # Will return current value for the key.
98
+ #
99
+ # Parameters:
100
+ # [keys] Array. Any number of parameters from which key will be generated.
101
+ #
102
+ # Returns:
103
+ # String. Current value for specified key or nil if key is not found.
71
104
  ###########################################################################
72
105
  def self.get_value(*keys)
73
106
  doc = find_by(key: keys.join('-'))
@@ -75,7 +108,11 @@ def self.get_value(*keys)
75
108
  end
76
109
 
77
110
  ###########################################################################
78
- #
111
+ # Will set value for the key. If document is not found new document will be created.
112
+ #
113
+ # Parameters:
114
+ # [value] String. New value to be set.
115
+ # [keys] Array. Any number of parameters from which key will be generated.
79
116
  ###########################################################################
80
117
  def self.set_value(value, *keys)
81
118
  doc = find_by(key: keys.join('-'))
@@ -20,6 +20,13 @@
20
20
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  #++
23
+
24
+ #########################################################################
25
+ # Mongoid::Document model for dc_links collection.
26
+ #
27
+ # DcLink documents may be used for creating alternative url links. page_id field must
28
+ # point to valid DcPage document which will be used for further processing.
29
+ #########################################################################
23
30
  class DcLink
24
31
  include Mongoid::Document
25
32
  include Mongoid::Timestamps
@@ -20,6 +20,14 @@
20
20
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  #++
23
+
24
+ #########################################################################
25
+ # Mongoid::Document model for dc_menus collection.
26
+ #
27
+ # Default menu system for DRG CMS. Model recursively embeds DcMenuItem documents
28
+ # which (theoretically) results in infinite level of sub menus. In practice
29
+ # reasonable maximum level of 4 is advised.
30
+ #########################################################################
23
31
  class DcMenu
24
32
  include Mongoid::Document
25
33
  include Mongoid::Timestamps
@@ -41,15 +49,24 @@ class DcMenu
41
49
  validates_length_of :description, minimum: 10
42
50
 
43
51
  #######################################################################
44
- #
52
+ # Will return all top level menu items of specified menu. Used in DcPage document for
53
+ # selecting top level selected menu, when document displayed in browser.
54
+ #
55
+ # Called from DcApplicationHelper :dc_choices4_menu: method.
56
+ #
57
+ # Parameters:
58
+ # [Site] DcSite document. Site for which menu belongs to. If site is not specified
59
+ # all current menus in dc_menus collection will be returned.
60
+ #
61
+ # Returns:
62
+ # Array. Of choices prepared for select input field.
45
63
  #######################################################################
46
64
  def self.choices4_menu(site)
47
65
  rez = []
48
66
  menus = (site.menu_name.blank? ? all : where(name: site.menu_name)).to_a
49
67
  menus.each do |menu|
50
68
  rez << [menu.name, nil]
51
- menu.dc_menu_items.where(active: true).order_by(:order => 1).each do |menu_item|
52
- # next unless menu_item.active
69
+ menu.dc_menu_items.where(active: true).order_by(order: 1).each do |menu_item|
53
70
  rez << ['-- ' + menu_item.caption, menu_item._id]
54
71
  end
55
72
  end
@@ -20,6 +20,13 @@
20
20
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  #++
23
+
24
+ #########################################################################
25
+ # Mongoid::Document model for dc_menu_items embedded documents.
26
+ #
27
+ # DcMenuItem documents are embedded in the DcMenu document and define one menu
28
+ # item of menu system.
29
+ #########################################################################
23
30
  class DcMenuItem
24
31
  include Mongoid::Document
25
32
  include Mongoid::Timestamps
@@ -22,7 +22,10 @@
22
22
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
23
  #++
24
24
 
25
- module DcPageCommon
25
+ #########################################################################
26
+ # ActiveSupport::Concern definition for DcPage class.
27
+ #########################################################################
28
+ module DcPageConcern
26
29
  extend ActiveSupport::Concern
27
30
  included do
28
31
 
@@ -56,6 +59,8 @@ field :kats, type: Array # Categories
56
59
  field :policy_id, type: BSON::ObjectId
57
60
 
58
61
  embeds_many :dc_parts
62
+ #embeds_many :dc_parts, as: :dc_parts
63
+
59
64
 
60
65
  belongs_to :dc_site
61
66
  belongs_to :dc_design
@@ -68,13 +73,12 @@ before_save :do_before_save
68
73
 
69
74
  validates :publish_date, presence: true
70
75
 
71
- ######################################################################
72
- #
73
76
  ######################################################################
74
77
  protected
75
78
 
76
79
  ######################################################################
77
- # Clears subject link of chars that shouldn't be there and also take care of its size
80
+ # Clears subject link of chars that shouldn't be there and also takes care
81
+ # than link size is not larger than 100 chars.
78
82
  ######################################################################
79
83
  def clear_link(link)
80
84
  link.gsub!(/\.|\?|\!\&|»|«|\,|\"|\'|\:/,'')
@@ -92,7 +96,7 @@ def clear_link(link)
92
96
  end
93
97
 
94
98
  ######################################################################
95
- #
99
+ # Implementation of before_save callback.
96
100
  ######################################################################
97
101
  def do_before_save
98
102
  if self.subject_link.empty?
@@ -102,10 +106,12 @@ def do_before_save
102
106
  end
103
107
  end
104
108
 
105
- ################################################################################
106
-
107
109
  ######################################################################
108
- # Return all pages belonging to site ready for select input field.
110
+ # Return all pages belonging to site ready for select input field. Used
111
+ # by dc_menu* forms, for selecting page which will be linked by menu option.
112
+ #
113
+ # Parameters:
114
+ # [site] Site document.
109
115
  ######################################################################
110
116
  def self.all_pages_for_site(site)
111
117
  where(dc_site_id: site._id, active: true).order(subject: 1).
@@ -115,9 +121,22 @@ end
115
121
  end
116
122
  end
117
123
 
118
- ######################################################################
119
- #
120
- ######################################################################
124
+ #########################################################################
125
+ # Mongoid::Document model for dc_page documents.
126
+ #
127
+ # DcPage documents are anchors for urls. Default DcApplicationController::dc_process_default_request()
128
+ # method searches for DcPage document by subject_link, id or alt_link. When found it loads
129
+ # design document defined by design_id and renders view code defined by design.
130
+ #
131
+ # Site owner has all control of how DcPage data is rendered by providing its own page renderer methods.
132
+ #
133
+ # Every DcPage document may embed many DcPart documents. DcPart documents mostly contain fields
134
+ # with same names and functionality as DcPage fields. And may therefore represent whole subpage data
135
+ # system within single document. Clever programmer may provide data for whole web site in just
136
+ # one DcSite, one DcMenu, one DcDesign and one DcPage document (with some embedded documents). And since
137
+ # DRG runs multiple sites on single Rails instance by default, may run hundreds of small sites
138
+ # on single Rails instance.
139
+ #########################################################################
121
140
  class DcPage
122
- include DcPageCommon
141
+ include DcPageConcern
123
142
  end
@@ -20,9 +20,39 @@
20
20
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  #++
23
- class DcPart < DcPiece
24
- embedded_in :dc_design
25
- embedded_in :dc_page
23
+ require_dependency DrgCms.model 'dc_piece'
24
+
25
+ ########################################################################
26
+ # Mongoid::Document model for dc_part embedded documents.
27
+ #
28
+ # DcPart model is used for embedding parts of final document into other models. It declares fields
29
+ # which may be used in various scenarios. For example:
30
+ # - part of page which is visible to all users and part only to registered users
31
+ # - list of pictures or attachments which belong to document
32
+ # -
33
+ #
34
+ # DcPart model inherits its definition from DcPiece model, but adds policy_id
35
+ # field to definition. Policy_id field may be used where site policy must be
36
+ # taken into account when rendering part.
37
+ ########################################################################
38
+ class DcPart
39
+ include DcPieceConcern
40
+
41
+ field :_type, type: String, default: 'DcPart' # needed when changed to Concern
42
+ field :policy_id, type: BSON::ObjectId
43
+ field :link, type: String
44
+
45
+ embedded_in :dc_parts, polymorphic: true
46
+
47
+ before_save :do_before_save
48
+
49
+ ######################################################################
50
+ # Implementation of before_save callback.
51
+ ######################################################################
52
+ def do_before_save
53
+ if self.link.empty?
54
+ self.link = self.name.strip.downcase.gsub(' ','-')
55
+ end
56
+ end
26
57
 
27
- field :policy_id, type: BSON::ObjectId
28
58
  end
@@ -21,20 +21,36 @@
21
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  #++
23
23
 
24
- #########################################################################
25
- #
24
+ ########################################################################
25
+ # Mongoid::Document model for dc_permissions collection.
26
+ #
27
+ # dc_permissions collection is used for saving documents which define permissions
28
+ # for accessing individual collections within DRG CMS system. Document which is marked
29
+ # as default is the top level document and defines general permissions valid for
30
+ # all collections. Other documents define permissions for accessing single
31
+ # collections or even embedded documents within collections.
26
32
  #########################################################################
27
33
  class DcPermission
28
- # Declaration of permissions
29
- NO_ACCESS = 0
30
- CAN_VIEW = 1
31
- CAN_CREATE = 2
32
- CAN_EDIT = 4
33
- CAN_EDIT_ALL = 8
34
- CAN_DELETE = 16
34
+ #- Available permissions settings
35
+
36
+ # User has no access
37
+ NO_ACCESS = 0
38
+ # User can view documents
39
+ CAN_VIEW = 1
40
+ # User can create new documents
41
+ CAN_CREATE = 2
42
+ # User can edit his own documents
43
+ CAN_EDIT = 4
44
+ # User can edit all documents in collection
45
+ CAN_EDIT_ALL = 8
46
+ # User can delete his own documents
47
+ CAN_DELETE = 16
48
+ # User can delete all documents in collection
35
49
  CAN_DELETE_ALL = 32
36
- CAN_ADMIN = 64
37
- SUPERADMIN = 128
50
+ # User can admin collection (same as can_delete_all, but can see documents which do not belong to current site)
51
+ CAN_ADMIN = 64
52
+ # User is superadmin. Basicly same as admin.
53
+ SUPERADMIN = 128
38
54
 
39
55
  include Mongoid::Document
40
56
  include Mongoid::Timestamps
@@ -51,7 +67,11 @@ index( { table_name: 1 }, { unique: true } )
51
67
  validates :table_name, presence: true
52
68
  validates :table_name, uniqueness: true
53
69
 
54
- def self.values_for_permissions
70
+ ########################################################################
71
+ # Will return choices for permissions prepared for usega in select input field.
72
+ # This will return english only comments so it is not used.
73
+ ########################################################################
74
+ def self.values_for_permissions #:nodoc:
55
75
  [['NO_ACCESS',0],['CAN_VIEW',1],['CAN_CREATE',2],['CAN_EDIT',4],['CAN_EDIT_ALL',8],['CAN_DELETE',16],['CAN_DELETE_ALL',32],['CAN_ADMIN',64],['SUPERADMIN',128]]
56
76
  end
57
77
 
@@ -20,7 +20,15 @@
20
20
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  #++
23
- class DcPiece
23
+
24
+
25
+ #########################################################################
26
+ # ActiveSupport::Concern definition for DcPiece class.
27
+ #########################################################################
28
+ module DcPieceConcern
29
+ extend ActiveSupport::Concern
30
+ included do
31
+
24
32
  include Mongoid::Document
25
33
  include Mongoid::Timestamps
26
34
 
@@ -44,14 +52,34 @@ class DcPiece
44
52
  field :created_by, type: BSON::ObjectId
45
53
  field :updated_by, type: BSON::ObjectId
46
54
 
55
+ validates :name, presence: true
56
+ end
57
+ end
58
+
59
+ ########################################################################
60
+ # Mongoid::Document model for dc_piece documents.
61
+ #
62
+ # DcPiece model is used for documents or pieces of web site which are common to site
63
+ # or perhaps to all sites in database. For example page footer is a good candidate
64
+ # to be saved in a dc_piece collection.
65
+ #
66
+ # Documents in dc_pieces collection must have unique name assigned. Default DcPartRenderer
67
+ # also looks into dc_pieces collection and collects all documents which belong to
68
+ # current site (site_id field) and renders them according to div_id field value.
69
+ ########################################################################
70
+ class DcPiece
71
+ include DcPieceConcern
72
+
47
73
  index( { name: 1 }, { unique: true } )
48
- index( { site_id: 1 } )
74
+ index( { site_id: 1 } )
75
+
76
+ validates :name, uniqueness: true
49
77
 
50
78
  ########################################################################
51
- # Return choices for select for dc_policy_role_id
79
+ # Return choices for select for selecting documents on dc_part form.
52
80
  ########################################################################
53
81
  def self.choices4_pieces
54
82
  all.inject([]) { |r,piece| r << [ piece.name, piece._id] }
55
83
  end
56
84
 
57
- end
85
+ end
@@ -21,8 +21,15 @@
21
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  #++
23
23
 
24
- #########################################################################
25
- #
24
+ ########################################################################
25
+ # Mongoid::Document model for dc_policy documents embedded into dc_sites collection documents.
26
+ #
27
+ # DcPolicy documents define policies for accessing data on web site. Policies define which
28
+ # user roles (defined in dc_policy_roles collection) has no access, can view or edit data (sees CMS menu) on
29
+ # current active web page. Policies can then be applied to individual documents belonging to the web site.
30
+ #
31
+ # Document defined as default, holds top level policy which is inherited by all
32
+ # other policies. Default policy is also used when document has no access policy assigned.
26
33
  #########################################################################
27
34
  class DcPolicy
28
35
  include Mongoid::Document
@@ -35,25 +42,23 @@ class DcPolicy
35
42
  field :updated_by, type: BSON::ObjectId
36
43
  field :message, type: String, default: ''
37
44
 
38
- #embeds_many :dc_policy_rules
39
45
  embeds_many :dc_policy_rules, as: :policy_rules
40
46
  embedded_in :dc_site
41
47
 
42
48
  validates :name, :length => { :minimum => 4 }
43
49
  validates :message, :length => { :minimum => 5 }
44
50
 
45
- # index name: 1
46
- # index 'dc_policy_rules._id' => 1
47
-
51
+ =begin
48
52
  #########################################################################
49
- #
53
+ # Returns values for permissions ready to be used in select field.
50
54
  #########################################################################
51
- def self.values_for_permissions
55
+ def self.values_for_permissions
52
56
  [['NO_ACCESS',0],['CAN_VIEW',1],['CAN_CREATE',2],['CAN_EDIT',4],['CAN_EDIT_ALL',8],['CAN_DELETE',16],['CAN_DELETE_ALL',32],['CAN_ADMIN',64],['SUPERADMIN',128]]
53
57
  end
54
58
 
59
+
55
60
  #########################################################################
56
- # returns all possible policy rules for use in select input field
61
+ # Returns all possible policy rules for use in select input field
57
62
  #########################################################################
58
63
  def self.choices4_policies()
59
64
  rez = []
@@ -65,7 +70,7 @@ def self.choices4_policies()
65
70
  end
66
71
  rez
67
72
  end
68
-
73
+
69
74
  #########################################################################
70
75
  # Returns policy rules for the site. Since it is called from policy_role form
71
76
  # which can be embedded in lots of tables (collections) table name of parent
@@ -90,5 +95,6 @@ def self.policy_rule_name_for(id)
90
95
  return 'Invalid policy name!' if pol.nil?
91
96
  pol.dc_policy_rules.find(id).name
92
97
  end
93
-
98
+ =end
99
+
94
100
  end