if user.admin?
# nop
elsif user.memberships.any?
- where("#{table_name}.visible = ? OR #{table_name}.id IN (SELECT DISTINCT cfr.custom_field_id FROM #{Member.table_name} m" +
- " INNER JOIN #{MemberRole.table_name} mr ON mr.member_id = m.id" +
- " INNER JOIN #{table_name_prefix}custom_fields_roles#{table_name_suffix} cfr ON cfr.role_id = mr.role_id" +
- " WHERE m.user_id = ?)",
+ where(
+ "#{table_name}.visible = ? OR #{table_name}.id IN (SELECT DISTINCT cfr.custom_field_id FROM #{Member.table_name} m" +
+ " INNER JOIN #{MemberRole.table_name} mr ON mr.member_id = m.id" +
+ " INNER JOIN #{table_name_prefix}custom_fields_roles#{table_name_suffix} cfr ON cfr.role_id = mr.role_id" +
+ " WHERE m.user_id = ?)",
true, user.id)
else
where(:visible => true)
visible? || user.admin?
end
- safe_attributes 'name',
+ safe_attributes(
+ 'name',
'field_format',
'possible_values',
'regexp',
'user_role',
'version_status',
'extensions_allowed',
- 'full_width_layout'
+ 'full_width_layout')
def format
@format ||= Redmine::FieldFormat.find(field_format)