Casbin Forum runs on Casnode, the open-source Discourse-style forum. Try the Casnode demo →
Casbin Forum
    @PatchMapping("/add")
    fun addUserToRole(
        @RequestParam username: String,
        @RequestParam roleName: String,
    ): Boolean {
        val role = roleService.getRole(roleName)
        val user = userService.getUser(username)
        user.roles.add(role)
        userService.updateUser(user)
        return true
    }

So I'm trying to add roles using the Java sdk in Kotlin. Is this how it's supposed to be done? I get the role and admin each and update the user with the role and use the update method in the userService. It doesn't seem to work

1views
2users
1 minread

see your DB, where the links are stored. Maybe in casbin table, or user, or role, I don't remember

1 / 2
Nov 2024