Home acl in grails using roles
Reply: 0

acl in grails using roles

user1103
1#
user1103 Published in May 24, 2018, 10:50 pm

I'm working on a Grails application where I do a user authentication based on session verification. Every user has a role, that I assign to it when I create the user. I want to limit access to links depending on roles. For example an admin can create and delete a user, a normal user can't do that. How can I do it in a simple easy way?

Here is the user.groovy:

class User {

    transient securiteService

    String username
    String password
    String nom
    String prenom
    String email
    String tel

    static hasMany = [roles : Role]

    static constraints = {
        username blank: false, unique: true
        password blank: false,display: false
        nom nullable: true
        prenom nullable: true
        email email:true, nullable:true
        tel nullable:true, maxSize:20,  matches:/[\+]{0,1}[0-9\s]{3,15}/
    }

    static mapping = {
        password column: '`password`'
        sort nom: "asc"
        affectations sort : "dateAffectation", order:"desc"
        intervention sort : "responsable", order:"desc"
    }
}
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.346505 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO