Skip to content

Commit

Permalink
item show bug on website front
Browse files Browse the repository at this point in the history
  • Loading branch information
anupnivargi committed Feb 23, 2010
1 parent 6d6fac4 commit f02a980
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/models/article.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class Article < ActiveRecord::Base

# Relation 1-N to the table 'article_files', managing the files linked to the article
has_many :article_files, :dependent => :delete_all

# Overwriting of the ActsAsXapian specification define in ActsAsItem,
# in order to include the 'body' field inside the Xapian index
acts_as_xapian :texts => [:title, :description, :keywords_list, :body],:terms => [[:title,'S',"title"],[:body,'B',"body"]]
Expand Down
10 changes: 5 additions & 5 deletions lib/authorized.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module ClassMethods
# and including instance methods usefull to get roles and permissions.
def acts_as_authorized
# Relation N-1 getting workspace Role objects through the 'users_workspaces' table
has_many :container_roles, :through => :users_containers, :source => :role, :include => :permissions
has_many :container_roles, :through => :users_containers, :source => :role
include Authorized::ModelMethods::InstanceMethods
end

Expand All @@ -25,7 +25,7 @@ module InstanceMethods
# Usage :
# <tt>user.system_role</tt>
def system_role
@role ||= Role.find(self.system_role_id, :include => [:permissions])
@role ||= Role.find(self.system_role_id)
end

# Method returning true if the user has the system role passed in params, false else
Expand All @@ -36,7 +36,7 @@ def system_role
# Usage :
# <tt>user.has_system_role('admin')</tt>
def has_system_role(role_name)
(self.system_role.name == role_name) || (self.system_role.name == 'superadmin')
(self.system_role.name == 'superadmin') || (self.system_role.name == role_name)
end

# Method returning true if the user has the workspace role passed in params, false else
Expand Down Expand Up @@ -84,7 +84,7 @@ def container_permissions(container_id, container)
# <tt>user.has_system_permission('workspaces','new')</tt>
def has_system_permission(controller, action)
permission_name = controller+'_'+action
!self.system_permissions.delete_if{ |e| e.name != permission_name}.blank? || self.has_system_role('superadmin')
return self.has_system_role('superadmin')|| !self.system_permissions.delete_if{ |e| e.name != permission_name}.blank?
end

# Method returning true if user has the workspace permission, false else
Expand All @@ -98,7 +98,7 @@ def has_system_permission(controller, action)
# <tt>user.has_workspace_permission('workspace_id','articles','new')</tt>
def has_container_permission(container_id, controller, action, container)
permission_name = controller+'_'+action
return !self.container_permissions(container_id,container).delete_if{ |e| e.name != permission_name}.blank? || self.has_system_role('superadmin')
return self.has_system_role('superadmin') || !self.container_permissions(container_id,container).delete_if{ |e| e.name != permission_name}.blank?
end

end
Expand Down
2 changes: 1 addition & 1 deletion lib/tag_lib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def current_page
end

def page_body
liquidize_page_body(render :partial => 'websites/page')
liquidize_page_body(@item ? (render :partial => 'websites/show') : (render :partial => 'websites/page') )
end

def page_title
Expand Down

0 comments on commit f02a980

Please sign in to comment.