qor / roles

Roles is an authorization library for Golang
MIT License
146 stars 35 forks source link

Removing roles #3

Closed fungl164 closed 7 years ago

fungl164 commented 8 years ago

Hi,

Right now it is not possible to remove or reset role definitions. It would be awesome to have the following utility functions if possible:

// Remove role definitions
func (role *Role) Remove(name string) {
    delete(role.definitions, name)
}

// Reset role definitions
func (role *Role) Reset() {
    role.definitions = map[string]func(req *http.Request, currentUser interface{}) bool{}
}

Msny Thnxs!

jinzhu commented 7 years ago

I think it is not necessary to remove a defined name, you could just create another roles set.