Commit 912dc651 by houdelin

change userable

parent 26f24a97
module CrmUc
module Userable
extend ActiveSupport::Concern
included do
include CrmUc::UserCenterable
# 如果要判断user是不是独立版用户,请用User#ikcrm_user?方法
enum user_type: {
normal_user: 0,
dingtalk_user: 1,
kingdee_user: 2,
wechat_user: 3,
wx_user: 4
}
enum status: [:hide, :visible]
if AppSettings.uc_enabled?
enum permission: [:deny, :edit, :show]
end
default_scope { usable }
scope :stateless, -> { unscope(where: [:status, :locked_at, :usable]) }
scope :visible, -> { stateless.where(status: statuses[:visible]) }
scope :usable, -> {
if AppSettings.uc_enabled?
where(usable: true)
else
where(status: statuses[:visible], locked_at: nil)
end
}
end
end
end
class User < ActiveRecord::Base
self.table_name = AppSettings.table_name('users')
include CrmUc::UserCenterable
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment