func (e *Entity) addProperty(propertyName string, data interface{}) error {
	propertyLock.Lock()
	defer propertyLock.Unlock()
	if data == nil {
		return fmt.Errorf("Cannot add property of '%v' to the entity: Property data is nil", propertyName)
	}
	_, exist := defs.PropertiesName[propertyName]
	if exist == false {
		return fmt.Errorf("The property name '%v' cannot be used, the allowed properties names are: %v", propertyName, defs.PropertiesName)
	}
	e.EntityProperties[propertyName] = data
	return nil
}
Add a property to the given entity using the property name and the given data
package entityManagement
import (
	"encoding/json"
	"fmt"
	"strings"
	defs "github.com/ibm-security-innovation/libsecurity-go/defs"
	ss "github.com/ibm-security-innovation/libsecurity-go/storage"
)
const (
	userTypeStr     = "User"
	groupTypeStr    = "Group"
	resourceTypeStr = "Resource"
	permissionTypeStr = "Permission"
)
type entityProperties map[string]interface{}
type groupOfUsers map[string]interface{}
type Entity struct {
	Name             string
	EntityProperties entityProperties
}
type User struct {
	Entity
}
type Group struct {
	Entity
	Group groupOfUsers
}
type Resource struct {
	Entity
}
func (e Entity) String() string {
	pArray := make([]string, 0, len(e.EntityProperties))
	for name := range e.EntityProperties {
		pArray = append(pArray, name)
	}
	return fmt.Sprintf("%v, Properties: %v", e.Name, strings.Join(pArray, ","))
}
func (u User) String() string {
	return fmt.Sprintf("%v: %v", userTypeStr, u.Entity)
}
func (r Resource) String() string {
	return fmt.Sprintf("%v: %v", resourceTypeStr, r.Entity)
}
func (g Group) String() string {
	nArray := make([]string, 0, len(g.Group))
	for n := range g.Group {
		nArray = append(nArray, n)
	}
	return fmt.Sprintf("%v: %v, Users list: %q", groupTypeStr, g.Entity, nArray)
}
func IsEntityNameValid(name string) error {
	if len(name) == 0 {
		return fmt.Errorf("Name is not valid, its length must be larger than 0")
	}
	return nil
}
func newUser(name string) (*User, error) {
	err := IsEntityNameValid(name)
	if err != nil {
		return nil, err
	}
	return &User{Entity{Name: name, EntityProperties: make(entityProperties)}}, nil
}
func newGroup(name string) (*Group, error) {
	err := IsEntityNameValid(name)
	if err != nil {
		return nil, err
	}
	e1 := Entity{Name: name, EntityProperties: make(entityProperties)}
	return &Group{Entity: e1, Group: make(groupOfUsers)}, nil
}
func newResource(name string) (*Resource, error) {
	err := IsEntityNameValid(name)
	if err != nil {
		return nil, err
	}
	return &Resource{Entity{Name: name, EntityProperties: make(entityProperties)}}, nil
}
func (g *Group) addUserToGroup(name string) error {
	lock.Lock()
	defer lock.Unlock()
	if len(name) == 0 {
		return fmt.Errorf("Cannot add a nil user")
	}
	err := IsEntityNameValid(name)
	if err != nil {
		return err
	}
	_, exist := g.Group[name]
	if exist {
		return fmt.Errorf("User '%v', is already in group '%v'", name, g.Group)
	}
	g.Group[name] = ""
	return nil
}
func (g *Group) removeUserFromGroup(name string) error {
	_, exist := g.Group[name]
	if exist == false {
		return fmt.Errorf("Cannot remove user '%v', not part of group '%v'", name, g.Group)
	}
	delete(g.Group, name)
	return nil
}
func (g Group) isUserInGroup(name string) bool {
	_, exist := g.Group[name]
	return exist
}