Esempio n. 1
0
func shareAppID(ctx appengine.Context, appid, email string) event.Event {
	resev := new(event.AdminResponseEvent)
	if !isValidSnovaSite(ctx, appid) {
		resev.ErrorCause = "This AppId is not a valid snova appid."
		return resev
	}
	item := getSharedAppItem(ctx, appid)
	if nil != item {
		resev.ErrorCause = "This AppId is already shared!"
		return resev
	}
	item = new(AppIDItem)
	item.AppID = appid
	item.Email = email
	saveSharedAppItem(ctx, item)
	sendMail(ctx, email, "Thanks for sharing AppID:"+appid+"!",
		"Thank you for sharing your appid!")
	resev.Response = "Success"
	return resev
}
Esempio n. 2
0
func unShareAppID(ctx appengine.Context, appid, email string) event.Event {
	resev := new(event.AdminResponseEvent)
	item := getSharedAppItem(ctx, appid)
	if nil == item {
		resev.ErrorCause = "This appid is not shared before!"
		return resev
	}

	if item.Email != email && item.Email != misc.MasterAdminEmail {
		resev.ErrorCause = "The input email address is not equal the share email address."
		return resev
	}
	item = new(AppIDItem)
	item.AppID = appid
	item.Email = email
	deleteSharedAppItem(ctx, item)
	email_content := "Your appid:" + appid + " is unshared from snova master."
	if item.Email == misc.MasterAdminEmail {
		email_content = email_content + "\nWe noticied that your shared appid:" + appid + " is not a valid Snova Server AppID."
	}
	sendMail(ctx, email, "Unshared AppID:"+appid+"!", email_content)
	resev.Response = "Success"
	return resev
}