From d0c2ff1776dad2ae600a95cf1754046534eb9cfa Mon Sep 17 00:00:00 2001 From: To-om Date: Fri, 22 Sep 2017 13:38:14 +0200 Subject: [PATCH] #33 Remove attribute "user" --- app/org/elastic4play/models/Attributes.scala | 3 +-- app/org/elastic4play/models/ModelDef.scala | 1 - app/org/elastic4play/services/CreateSrv.scala | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/app/org/elastic4play/models/Attributes.scala b/app/org/elastic4play/models/Attributes.scala index 95de9f2..8409379 100644 --- a/app/org/elastic4play/models/Attributes.scala +++ b/app/org/elastic4play/models/Attributes.scala @@ -60,7 +60,7 @@ object AttributeFormat { object AttributeOption extends Enumeration with HiveEnumeration { type Type = Value - val readonly, unaudited, model, form, sensitive, user = Value + val readonly, unaudited, model, form, sensitive = Value } case class Attribute[T]( @@ -88,7 +88,6 @@ case class Attribute[T]( case _: MultiAttributeFormat[_] ⇒ false case _ ⇒ true } - lazy val isUser: Boolean = options.contains(AttributeOption.user) def elasticMapping: FieldDefinition = format.elasticType(name) match { case a: BasicFieldDefinition if isSensitive ⇒ a.index("no") diff --git a/app/org/elastic4play/models/ModelDef.scala b/app/org/elastic4play/models/ModelDef.scala index e2eb00e..c5cc3f8 100644 --- a/app/org/elastic4play/models/ModelDef.scala +++ b/app/org/elastic4play/models/ModelDef.scala @@ -51,7 +51,6 @@ abstract class ModelAttributes(val name: String) extends AttributeDef { attr } - val user = attribute("user", AttributeFormat.stringFmt, "user", None, AttributeOption.readonly, AttributeOption.model) val createdBy = attribute("createdBy", AttributeFormat.stringFmt, "user who created this entity", None, AttributeOption.model, AttributeOption.readonly) val createdAt = attribute("createdAt", AttributeFormat.dateFmt, "user who created this entity", new Date, AttributeOption.model, AttributeOption.readonly) val updatedBy = optionalAttribute("updatedBy", AttributeFormat.stringFmt, "user who created this entity", None, AttributeOption.model) diff --git a/app/org/elastic4play/services/CreateSrv.scala b/app/org/elastic4play/services/CreateSrv.scala index 872d0b0..453c18c 100644 --- a/app/org/elastic4play/services/CreateSrv.scala +++ b/app/org/elastic4play/services/CreateSrv.scala @@ -57,7 +57,6 @@ class CreateSrv @Inject() ( private[services] def addMetaFields(attrs: JsObject)(implicit authContext: AuthContext): JsObject = attrs ++ Json.obj( - "user" → authContext.userId, "createdBy" → authContext.userId, "createdAt" → Json.toJson(new Date))