diff --git a/app/assets/javascripts/app/controllers/organizations.js.coffee b/app/assets/javascripts/app/controllers/organizations.js.coffee index 572f148d5..be43ce667 100644 --- a/app/assets/javascripts/app/controllers/organizations.js.coffee +++ b/app/assets/javascripts/app/controllers/organizations.js.coffee @@ -40,9 +40,6 @@ Config.NavBar['AdminTrigger'] = { prio: 3000, parent: '#admin', name: 'Trigger', Config.NavBar['AdminScheduler'] = { prio: 3500, parent: '#admin', name: 'Scheduler', target: '#scheduler', role: ['Admin'] } -Config.NavBar['Note'] = { prio: 1500, parent: '', name: 'Notes', target: '#notes', role: ['Notes'] } -#Config.NavBar['Post'] = { prio: 1600, parent: '', name: 'Posts', target: '#posts', role: ['Agent'] } - Config.NavBar['Setting'] = { prio: 20000, parent: '', name: 'Settings', target: '#settings', role: ['Admin'] } Config.NavBar['SettingSystem'] = { prio: 1400, parent: '#settings', name: 'System', target: '#settings/system', role: ['Admin'] } Config.NavBar['SettingSecurity'] = { prio: 1500, parent: '#settings', name: 'Security', target: '#settings/security', role: ['Admin'] } diff --git a/app/assets/javascripts/app/views/navigation.jst.eco b/app/assets/javascripts/app/views/navigation.jst.eco index f7f20f646..957fd7033 100644 --- a/app/assets/javascripts/app/views/navigation.jst.eco +++ b/app/assets/javascripts/app/views/navigation.jst.eco @@ -40,13 +40,6 @@
  • Sign in
  • <% end %> - - \ No newline at end of file + diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index bb69464e5..c130edd16 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,7 +1,7 @@ class ApplicationController < ActionController::Base include UserInfo protect_from_forgery - http_basic_authenticate_with :name => "test", :password => "ttt" +# http_basic_authenticate_with :name => "test", :password => "ttt" helper_method :current_user, :authentication_check @@ -128,7 +128,6 @@ class ApplicationController < ActionController::Base logger.debug 'authentication_check' # check http basic auth - if false authenticate_with_http_basic do |user, password| logger.debug 'http basic auth check' # logger.debug session.inspect @@ -149,11 +148,6 @@ class ApplicationController < ActionController::Base # message = 'login required' if message != '' respond_to do |format| -# format.html { -# flash[:notice] = "You're not logged in!" -# store_location -# redirect_to :login -# } format.json { render :json => { :error => message }, :status => :unauthorized } @@ -163,10 +157,9 @@ class ApplicationController < ActionController::Base # return true # request_http_basic_authentication end - end - logger.debug 'session check' - logger.debug session.inspect +# logger.debug 'session check' +# logger.debug session.inspect # session[:user_id] = 2 if !session[:user_id] # = userdata.id @@ -175,11 +168,6 @@ class ApplicationController < ActionController::Base logger.debug session.inspect message = 'no valid session, user_id' respond_to do |format| -# format.html { -# flash[:notice] = "You're not logged in!" -# store_location -# redirect_to :login -# } format.json { render :json => { :error => message }, :status => :unauthorized } diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb deleted file mode 100644 index d54711546..000000000 --- a/app/controllers/notes_controller.rb +++ /dev/null @@ -1,86 +0,0 @@ -class NotesController < ApplicationController - before_filter :authentication_check - - # GET /notes - # GET /notes.json - def index - @notes = Note.find(:all, :order => "updated_at ASC") -# @notes = Note.all - - respond_to do |format| - format.html # index.html.erb - format.json { render :json => @notes } - end - end - - # GET /notes/1 - # GET /notes/1.json - def show - @note = Note.find(params[:id]) - - respond_to do |format| - format.html # show.html.erb - format.json { render :json => @note } - end - end - - # GET /notes/new - # GET /notes/new.json - def new - @note = Note.new - - respond_to do |format| - format.html # new.html.erb - format.json { render :json => @note } - end - end - - # GET /notes/1/edit - def edit - @note = Note.find(params[:id]) - end - - # POST /notes - # POST /notes.json - def create - @note = Note.new(params[:note]) - - respond_to do |format| - if @note.save - format.html { redirect_to @note, :notice => 'Note was successfully created.' } - format.json { render :json => @note, :status => :created } - else - format.html { render :action => "new" } - format.json { render :json => @note.errors, :status => :unprocessable_entity } - end - end - end - - # PUT /notes/1 - # PUT /notes/1.json - def update - @note = Note.find(params[:id]) - - respond_to do |format| - if @note.update_attributes(params[:note]) - format.html { redirect_to @note, :notice => 'Note was successfully updated.' } - format.json { render :json => @note, :status => :ok } - else - format.html { render :action => "edit" } - format.json { render :json => @note.errors, :status => :unprocessable_entity } - end - end - end - - # DELETE /notes/1 - # DELETE /notes/1.json - def destroy - @note = Note.find(params[:id]) - @note.destroy - - respond_to do |format| - format.html { redirect_to notes_url } - format.json { head :ok } - end - end -end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 386ac55c2..f49a5793b 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -135,10 +135,10 @@ class SessionsController < ApplicationController default_collection['TicketPriority'] = Ticket::Priority.all default_collection['TicketArticleType'] = Ticket::Article::Type.all default_collection['TicketArticleSender'] = Ticket::Article::Sender.all - default_collection['Forum'] = Forum.all - default_collection['ForumCategory'] = Forum::Category.all - default_collection['ForumCategoryType'] = Forum::Category::Type.all - default_collection['ForumPrivacy'] = Forum::Privacy.all + default_collection['Network'] = Network.all + default_collection['NetworkCategory'] = Network::Category.all + default_collection['NetworkCategoryType'] = Network::Category::Type.all + default_collection['NetworkPrivacy'] = Network::Privacy.all return default_collection end end \ No newline at end of file diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb deleted file mode 100644 index 8078f7303..000000000 --- a/app/helpers/notes_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module NotesHelper -end diff --git a/config/environment.rb b/config/environment.rb index 29bc2bc2f..7cfe94f39 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,8 @@ # Load the rails application require File.expand_path('../application', __FILE__) +# load module used to get current user for active recorde observer +require 'user_info' + # Initialize the rails application Zammad::Application.initialize! diff --git a/db/migrate/20120101000020_create_network.rb b/db/migrate/20120101000020_create_network.rb index 6f8b1b2b4..62ca22ece 100644 --- a/db/migrate/20120101000020_create_network.rb +++ b/db/migrate/20120101000020_create_network.rb @@ -70,7 +70,7 @@ class CreateNetwork < ActiveRecord::Migration t.column :created_by_id, :integer, :null => false t.timestamps end - add_index :network_category_subscriptions, [:network_categories_id, :created_by_id], :unique => true, :name => 'index_network_category_subscriptions_on_network_categories_i_and_c' + add_index :network_category_subscriptions, [:network_categories_id, :created_by_id], :unique => true, :name => 'index_network_category_subscriptions_on_network_c_i_and_c' create_table :network_item_subscriptions do |t| diff --git a/lib/user_info.rb b/lib/user_info.rb new file mode 100644 index 000000000..811a5e66f --- /dev/null +++ b/lib/user_info.rb @@ -0,0 +1,9 @@ +module UserInfo + def current_user_id + Thread.current[:user_id] + end + + def self.current_user_id=(user_id) + Thread.current[:user_id] = user_id + end +end \ No newline at end of file