Browse Source

fix: project permission and update user lastname

tags/v3.1.5
vilet.yy 5 years ago
parent
commit
0e7f3a8905
2 changed files with 6 additions and 2 deletions
  1. +1
    -1
      app/models/concerns/project_operable.rb
  2. +5
    -1
      app/models/user.rb

+ 1
- 1
app/models/concerns/project_operable.rb View File

@@ -65,7 +65,7 @@ module ProjectOperable
if owner.is_a?(User)
managers.exists?(user_id: user.id)
elsif owner.is_a?(Organization)
managers.exists?(user_id: user.id) || owner.is_only_admin?(user.id)
managers.exists?(user_id: user.id) || owner.is_owner?(user.id) || owner.is_only_admin?(user.id)
else
false
end


+ 5
- 1
app/models/user.rb View File

@@ -186,7 +186,7 @@ class User < Owner
:show_email, :show_location, :show_department,
:technical_title, :province, :city, :custom_department, to: :user_extension, allow_nil: true

before_save :update_hashed_password
before_save :update_hashed_password, :set_lastname
after_create do
SyncTrustieJob.perform_later("user", 1) if allow_sync_to_trustie?
end
@@ -779,6 +779,10 @@ class User < Owner

self.laboratory = Laboratory.current if laboratory_id.blank?
end

def set_lastname
self.lastname = self.nickname if changes[:nickname].present?
end
end




Loading…
Cancel
Save