app/models/note.rb
# Viewing privileges are different. A parent object sets the viewing
# privilege policy for the notes that it contains. The assumption is that
# the parent object will not render the note if the logged user doesn't
# have viewing privileges. However, we are double-checking here... the
# note won't should not get rendered for any reason if PRIVILEGE_NONE
# is returned.
Viewing privileges are different. A parent object sets the viewing
privilege policy for the notes that it contains. The assumption is that
the parent object will not render the note if the logged user doesn't
have viewing privileges. However, we are double-checking here... the
note won't should not get rendered for any reason if PRIVILEGE_NONE
is returned.
Viewing privileges are different . A parent object sets the viewing privilege policy for the notes that it contains . The assumption is that the parent object will not render the note if the logged user doesn ' t have viewing privileges . However we are double - checking here ... the note won ' t should not get rendered for any reason if PRIVILEGE_NONE is returned .
def privileges(user, parent_priv = nil)
		if user.admin?
			return PRIVILEGE_EDIT
		end
		if self.creator_id.nil? && user.privilege >= User::PRIVILEGE_STAFF
		  return PRIVILEGE_EDIT
		end 
		if self.creator_id == user.id
			return PRIVILEGE_EDIT
		end
		parent_priv ||= self.notable.privileges(user)
		return PRIVILEGE_EDIT if parent_priv[:edit_note]
		return PRIVILEGE_VIEW if parent_priv[:view_note]
		return PRIVILEGE_NONE
	end
def privileges ( user , parent_priv = nil ) if user . admin? return PRIVILEGE_EDIT end if self . creator_id . nil? && user . privilege >= User :: PRIVILEGE_STAFF return PRIVILEGE_EDIT end if self . creator_id == user . id return PRIVILEGE_EDIT end parent_priv ||= self . notable . privileges ( user ) return PRIVILEGE_EDIT if parent_priv [ :edit_note ] return PRIVILEGE_VIEW if parent_priv [ :view_note ] return PRIVILEGE_NONE end
Viewing privileges are different.
Viewing privileges are different .
user
<not_specific>
parent_priv
<not_specific>