Commit ba2af642c63ad390dbb71b02f8c387cfed36e19a
1 parent
2ee61f6b
Exists in
master
and in
5 other branches
Admin dont have to aprove software for himself
-Delete software if aproval not granted Signed-off-by: Parley Martins <parley@outlook.com> Signed-off-by: Gustavo Jaruga <darksshades@gmail.com> Signed-off-by: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com>
Showing
2 changed files
with
4 additions
and
4 deletions
Show diff stats
controllers/mpog_software_plugin_myprofile_controller.rb
@@ -64,7 +64,7 @@ class MpogSoftwarePluginMyprofileController < MyProfileController | @@ -64,7 +64,7 @@ class MpogSoftwarePluginMyprofileController < MyProfileController | ||
64 | end | 64 | end |
65 | end | 65 | end |
66 | 66 | ||
67 | - if environment.enabled?("admin_must_approve_new_communities") | 67 | + if environment.enabled?("admin_must_approve_new_communities") and !environment.admins.include?(current_user.person) |
68 | session[:notice] = _('Your new software request will be evaluated by an administrator. You will be notified.') | 68 | session[:notice] = _('Your new software request will be evaluated by an administrator. You will be notified.') |
69 | redirect_to user.admin_url | 69 | redirect_to user.admin_url |
70 | else | 70 | else |
lib/ext/community.rb
@@ -4,8 +4,8 @@ class Community | @@ -4,8 +4,8 @@ class Community | ||
4 | 4 | ||
5 | attr_accessible :visible | 5 | attr_accessible :visible |
6 | 6 | ||
7 | - has_one :software_info, :dependent=>:delete | ||
8 | - has_one :institution, :dependent=>:delete | 7 | + has_one :software_info, :dependent=>:destroy |
8 | + has_one :institution, :dependent=>:destroy | ||
9 | 9 | ||
10 | def self.create_after_moderation(requestor, attributes = {}, software_info = nil, license_info = nil, software_categories = nil) | 10 | def self.create_after_moderation(requestor, attributes = {}, software_info = nil, license_info = nil, software_categories = nil) |
11 | community = Community.new(attributes) | 11 | community = Community.new(attributes) |
@@ -21,7 +21,7 @@ class Community | @@ -21,7 +21,7 @@ class Community | ||
21 | software_info.save | 21 | software_info.save |
22 | end | 22 | end |
23 | 23 | ||
24 | - if community.environment.enabled?('admin_must_approve_new_communities') | 24 | + if community.environment.enabled?('admin_must_approve_new_communities') and !community.environment.admins.include?(requestor) |
25 | cc = CreateCommunity.create(attributes.merge(:requestor => requestor, :software_info=>software_info)) | 25 | cc = CreateCommunity.create(attributes.merge(:requestor => requestor, :software_info=>software_info)) |
26 | else | 26 | else |
27 | community = Community.create(attributes) | 27 | community = Community.create(attributes) |