Overview

Play Auth provides number of template helpers that allow you to control content of your pages.

Authentication related helpers

@import ch.insign.playauth.views.helper._

<!-- Show block only for authentiaced party -->
@authenticated { party =>
    Hello @party.getName
}

<!-- Show block only for unauthentiaced party --> 
@notAuthenticated {

    <!-- Show block only for rememebered party --> 
    @remembered { party =>
        Welcome back @party.getName, please confirm your identity: [ enter password here ].
    }
 
    <!-- Show block only for not remembered party --> 
    @notRemembered {
        Please, #login or #register.
    }
}

<!-- Show block only for anonymous party -->  
@anonymous {
    Please, #login or #register.
}

<!-- Show block only for not anonymous party -->   
@notAnonymous { party =>
    @authenticated { party =>
        Hello @party.getName
    }
 
    @remembered { party =>
        Welcome back @party.getName, please confirm your identity: [ enter password here ].
    }
}

<!-- Show block only for impersonated party -->  
@impersonated { (currParty, origParty) =>
    Hello @currParty.getName
    #returnBack to @origParty.getName account
}

 Authorization related helpers

@import ch.insign.playauth.views.helper._
@import ch.insign.playauth.party.support.PartyPermission
@import ch.insign.playauth.party.Party
@import your.domain.model.SubtypeOfParty
 
 
@hasPermission(PartyPermission.UPDATE) {
    You are able to update any Party
}
 
@hasPermission(PartyPermission.UPDATE(classOf[SubtypeOfParty])) {
    You are able to update all SubtypeOfParty
}
 
@hasPermission(PartyPermission.UPDATE(partyObj)) {
    You are able to update @partyObj.getName
}
 
@lacksPermission(PartyPermission.UPDATE(partyObj)) {
    You are NOT able to update @partyObj.getName
}
 
@hasAnyPermision(PartyPermission.UPDATE(partyObj), PartyPermission.DELETE(partyObj)) {
    You can update or delete @partyObj.getName
}
 
@lacksAnyPermision(PartyPermission.UPDATE(partyObj), PartyPermission.DELETE(partyObj)) {
    You can NOT update and/or delete @partyObj.getName
}