diff --git a/app/controllers/admin/enterprises_controller.rb b/app/controllers/admin/enterprises_controller.rb
deleted file mode 100644
index d4599fb..0000000
--- a/app/controllers/admin/enterprises_controller.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class EnterprisesController < AdminController
-
- def index
- @enterprises = Enterprise.find(:all)
- end
-
-end
diff --git a/app/helpers/enterprises_helper.rb b/app/helpers/enterprises_helper.rb
deleted file mode 100644
index 10321ba..0000000
--- a/app/helpers/enterprises_helper.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-module EnterprisesHelper
-end
diff --git a/app/views/admin_panel/index.rhtml b/app/views/admin_panel/index.rhtml
index 715e068..f5ccc30 100644
--- a/app/views/admin_panel/index.rhtml
+++ b/app/views/admin_panel/index.rhtml
@@ -9,5 +9,4 @@
<%= link_to _('Manage Categories'), :controller => 'categories'%>
<%= link_to _('Manage User roles'), :controller => 'role' %>
<%= link_to _('Manage Validators by region'), :controller => 'region_validators' %>
- <%= link_to _('Manage Enterprises'), :controller => 'enterprises' %>
diff --git a/app/views/blocks/profile_info.rhtml b/app/views/blocks/profile_info.rhtml
index ace35f6..adea1b3 100644
--- a/app/views/blocks/profile_info.rhtml
+++ b/app/views/blocks/profile_info.rhtml
@@ -6,7 +6,7 @@
<%= _('Since %{year}/%{month}') % { :year => block.owner.created_at.year, :month => block.owner.created_at.month } %>
<%= link_to _('Homepage'), block.owner.url %>
<%= link_to _('View profile'), block.owner.public_profile_url %>
- <% if profile == user %>
+ <% if !user.nil? and user.has_permission?('edit_profile', profile) %>
<%= link_to _('Control panel'), :controller => 'profile_editor' %>
<% end %>
diff --git a/app/views/enterprises/index.rhtml b/app/views/enterprises/index.rhtml
deleted file mode 100644
index 3dfe0f7..0000000
--- a/app/views/enterprises/index.rhtml
+++ /dev/null
@@ -1,22 +0,0 @@
-<%= _("%s's enterprises") % environment.name %>
-
-
-<% for enterprise in @enterprises %>
-
- <%= image_tag(profile_icon(enterprise)) %> |
-
- <%= _('Name: %s') % link_to(enterprise.name, enterprise.url) %>
- <%#= _('Description: %s') % enterprise.description + ' ' if enterprise.kind_of?(Community) %>
- <%= _('Created at: %s') % show_date(enterprise.created_at) %>
- <%= _('Actions: %s') % link_to(_('Manage'), enterprise.admin_url) %>
-
- |
-
-<% end %>
-
-
-<% button_bar do %>
- <%#= button :add, _('Register a new Enterprise'), :controller => 'enterprise_registration' %>
- <%#= button :add, _('Create a new community'), :action => 'new_community' %>
- <%#= button :back, _('Go back'), :controller => 'profile_editor' %>
-<% end %>
diff --git a/test/functional/admin_panel_controller_test.rb b/test/functional/admin_panel_controller_test.rb
index a20c55a..f459e58 100644
--- a/test/functional/admin_panel_controller_test.rb
+++ b/test/functional/admin_panel_controller_test.rb
@@ -72,9 +72,4 @@ class AdminPanelControllerTest < Test::Unit::TestCase
assert_equal "This is alert('alow')my new environment", Environment.default.description
end
- should 'link to manage enterprises' do
- get :index
- assert_tag :tag => 'a', :attributes => { :href => '/admin/enterprises' }
- end
-
end
diff --git a/test/functional/enterprises_controller_test.rb b/test/functional/enterprises_controller_test.rb
deleted file mode 100644
index 9d9cea2..0000000
--- a/test/functional/enterprises_controller_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-
-class EnterprisesControllerTest < ActionController::TestCase
- # Replace this with your real tests.
- def test_truth
- assert true
- end
-end
diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb
index a9da92a..1c14bcd 100644
--- a/test/functional/profile_controller_test.rb
+++ b/test/functional/profile_controller_test.rb
@@ -153,6 +153,8 @@ class ProfileControllerTest < Test::Unit::TestCase
assert_no_tag :tag => 'ul', :attributes => { :class => 'profile-info-data' }, :descendant => { :tag => 'a', :content => 'Control panel' }
end
+ should 'show a link to control panel if user has profile_editor permission'
+
should 'show create community in own profile' do
login_as(@profile.identifier)
get :communities, :profile => @profile.identifier
diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb
index 13e813c..0b92858 100644
--- a/test/functional/profile_editor_controller_test.rb
+++ b/test/functional/profile_editor_controller_test.rb
@@ -310,7 +310,7 @@ class ProfileEditorControllerTest < Test::Unit::TestCase
user2 = create_user('usertwo').person
AddFriend.create!(:person => user1, :friend => user2)
@controller.stubs(:user).returns(user2)
- user2.expects(:has_permission?).with('edit_profile', anything).returns(true)
+ user2.stubs(:has_permission?).with('edit_profile', anything).returns(true)
user2.expects(:has_permission?).with(:manage_friends, anything).returns(true)
login_as('usertwo')
get :index, :profile => 'usertwo'
@@ -322,7 +322,7 @@ class ProfileEditorControllerTest < Test::Unit::TestCase
user2 = create_user('usertwo').person
task = AddFriend.create!(:person => user1, :friend => user2)
@controller.stubs(:user).returns(user2)
- user2.expects(:has_permission?).with('edit_profile', anything).returns(true)
+ user2.stubs(:has_permission?).with('edit_profile', anything).returns(true)
user2.expects(:has_permission?).with(:manage_friends, anything).returns(false)
login_as('usertwo')
get :index, :profile => 'usertwo'
--
libgit2 0.21.2