func initState() {
	a := acl.NewACL()
	for _, name := range resourcesName {
		stRestful.UsersList.AddResource(name)
		stRestful.UsersList.AddPropertyToEntity(name, defs.AclPropertyName, a)
	}
	for _, name := range usersName {
		stRestful.UsersList.AddUser(name)
	}
}
func (a *AclRestful) restAddAclToResource(request *restful.Request, response *restful.Response) {
	var a1 *acl.Acl
	resourceName := request.PathParameter(resourceNameParam)

	err := request.ReadEntity(&a1)
	if err != nil {
		a1 = acl.NewACL()
	}
	if a.addAclToResource(request, response, resourceName, a1) == false {
		return
	}
	response.WriteHeaderAndEntity(http.StatusCreated, a.getURLPath(request, resourceToken, resourceName))
}
func initEntityManager() *en.EntityManager {
	entityManager := en.New()
	for _, name := range usersName {
		entityManager.AddUser(name)
	}
	entityManager.AddGroup(groupName)
	for _, name := range groupUsersName {
		entityManager.AddUser(name)
		entityManager.AddUserToGroup(groupName, name)
	}
	entityManager.AddResource(resourceName)
	a := acl.NewACL()
	entityManager.AddPropertyToEntity(resourceName, defs.AclPropertyName, a)
	return entityManager
}
func (en *EnRestful) restCreateResource(request *restful.Request, response *restful.Response) {
	id := request.PathParameter(resourceIDParam)
	err := en.st.UsersList.AddResource(id)
	if err != nil {
		en.setError(response, http.StatusPreconditionFailed, err)
		return
	}
	newAcl := acl.NewACL()
	err = en.st.UsersList.AddPropertyToEntity(id, defs.AclPropertyName, newAcl)
	if err != nil {
		en.setError(response, http.StatusPreconditionFailed, err)
		return
	}
	response.WriteHeaderAndEntity(http.StatusCreated, en.getResourceURLPath(request, id))
}
func generateAcl() (string, *acl.Acl, error) {
	stRestful.UsersList.AddResource(resourceName1)
	stRestful.UsersList.AddGroup(groupName)
	for _, name := range usersName {
		stRestful.UsersList.AddUser(name)
		stRestful.UsersList.AddUserToGroup(groupName, name)
	}
	aclData := acl.NewACL()
	for _, name := range usersName {
		for _, p := range usersPermissions {
			stRestful.UsersList.AddPermission(en.Permission(p))
			aclData.AddPermissionToEntity(stRestful.UsersList, name, en.Permission(p))
		}
	}
	stRestful.UsersList.AddPermission(en.Permission(perAll))
	aclData.AddPermissionToEntity(stRestful.UsersList, defs.AclAllEntryName, perAll)
	stRestful.UsersList.AddPropertyToEntity(resourceName1, defs.AclPropertyName, aclData)
	data, _ := json.Marshal(aclData)
	return string(data), aclData, nil
}
func (a AclRestful) restSetPermission(request *restful.Request, response *restful.Response) {
	a1, aclInfo, err := a.getResourceAclData(request, response)
	if err != nil {
		a.setError(response, http.StatusNotFound, err)
		return
	}
	if a1 == nil {
		eAcl := acl.NewACL()
		a.addAclToResource(request, response, aclInfo.ResourceName, eAcl)
		a1, aclInfo, err = a.getResourceAclData(request, response)
		if err != nil {
			a.setError(response, http.StatusInternalServerError, err)
			return
		}
	}
	err = a1.AddPermissionToEntity(a.st.UsersList, aclInfo.UserName, en.Permission(aclInfo.Permission))
	if err != nil {
		a.setError(response, http.StatusNotFound, err)
	} else {
		response.WriteHeaderAndEntity(http.StatusCreated, a.getURLPath(request, entityToken, fmt.Sprintf("%v/%v/%v/%v/%v", aclInfo.UserName, resourceToken, aclInfo.ResourceName, permissionsToken, aclInfo.Permission)))
	}
}
func Test_AddCheckRemoveACLUserProperty(t *testing.T) {
	moduleData := acl.NewACL()

	testAddCheckRemoveUserProperty(t, defs.AclPropertyName, moduleData)
}