diff --git a/app/controllers/Application.scala b/app/controllers/Application.scala index c01355a4..14032e92 100644 --- a/app/controllers/Application.scala +++ b/app/controllers/Application.scala @@ -67,10 +67,18 @@ class Application(implicit val env: Environment[Login, CachedCookieAuthenticator } def conferences = UserAwareAction { implicit request => + val is_admin = request.identity match { + case Some(uid) => uid.account.isAdmin + case _ => false + } + val conferences = conferenceService.list() - val list_opened = conferences.filter(conf => conf.isOpen) val list_published = conferences.filter(conf => conf.isPublished && !conf.isOpen) + var list_opened = conferences.filter(conf => !list_published.contains(conf)) + if (!is_admin) { + list_opened = list_opened.filter(conf => conf.isOpen) + } Ok(views.html.conferencelist(request.identity.map{ _.account }, list_opened, list_published)) } @@ -112,7 +120,6 @@ class Application(implicit val env: Environment[Login, CachedCookieAuthenticator } } - def adminAbstracts(confId: String) = SecuredAction { implicit request => val conference = conferenceService.get(confId) diff --git a/app/models/Conference.scala b/app/models/Conference.scala index 18213e43..8ae11d35 100644 --- a/app/models/Conference.scala +++ b/app/models/Conference.scala @@ -33,6 +33,7 @@ class Conference extends Model with Owned { def dateFormatter = DateTimeFormat.forPattern("d MMMM, yyyy") var name: String = _ + @Column(unique = true) var short: String = _ var cite: String = _ var link: String = _ diff --git a/test/controller/ConferenceCtrlTest.scala b/test/controller/ConferenceCtrlTest.scala index 2a69874a..765bcb5a 100644 --- a/test/controller/ConferenceCtrlTest.scala +++ b/test/controller/ConferenceCtrlTest.scala @@ -26,7 +26,7 @@ class ConferenceCtrlTest extends BaseCtrlTest { @Test def testCreate(): Unit = { - val body = formatter.writes(assets.conferences(0)).as[JsObject] - "uuid" - "abstracts" + val body = formatter.writes(assets.conferences(0)).as[JsObject] - "uuid" - "abstracts" - "short" val createUnauth = FakeRequest(POST, "/api/conferences").withHeaders( ("Content-Type", "application/json")