Browse Source

设置非public图片查看权限

pull/347/head
呱呱呱 2 years ago
parent
commit
2c4253b04b
2 changed files with 5 additions and 1 deletions
  1. +1
    -0
      app/controllers/attachments_controller.rb
  2. +4
    -1
      app/models/identity_verification.rb

+ 1
- 0
app/controllers/attachments_controller.rb View File

@@ -229,6 +229,7 @@ class AttachmentsController < ApplicationController
end
tip_exception(403, "您没有权限进入") if project.present? && !candown
end
tip_exception(403, "您没有权限查看") if project.present? && !candown if @file.is_public == 0 && author_id != current_user.id
end
end



+ 4
- 1
app/models/identity_verification.rb View File

@@ -23,7 +23,10 @@
class IdentityVerification < ApplicationRecord
belongs_to :user
enum state: { "待审核": 0, "已通过": 1, "已拒绝": 2}

after_create do
Attachment.where(id:[card_front,card_back,hold_card_front,hold_card_back]).update_all(is_public:0)
end
after_save do
if state == "已通过"
user.update(id_card_verify: true, website_permission: true)


Loading…
Cancel
Save