当前位置: 首页>>代码示例>>Golang>>正文


Golang Context.IsGroupAdmin方法代码示例

本文整理汇总了Golang中socialapi/models.Context.IsGroupAdmin方法的典型用法代码示例。如果您正苦于以下问题:Golang Context.IsGroupAdmin方法的具体用法?Golang Context.IsGroupAdmin怎么用?Golang Context.IsGroupAdmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在socialapi/models.Context的用法示例。


在下文中一共展示了Context.IsGroupAdmin方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: GetCustomer

// GetCustomer returns the customer info of a group
func GetCustomer(u *url.URL, h http.Header, _ interface{}, context *models.Context) (int, http.Header, interface{}, error) {
	if err := context.IsGroupAdmin(); err != nil {
		return response.NewBadRequest(err)
	}

	return response.HandleResultAndError(
		payment.GetCustomerForGroup(context.GroupName),
	)
}
开发者ID:,项目名称:,代码行数:10,代码来源:

示例2: ListMembers

// ListMembers lists the members of group
func ListMembers(u *url.URL, h http.Header, _ interface{}, context *models.Context) (int, http.Header, interface{}, error) {
	if err := context.IsGroupAdmin(); err != nil {
		return response.NewBadRequest(err)
	}

	query := request.GetQuery(u)
	query = context.OverrideQuery(query)
	p := &models.PresenceDaily{}
	return response.HandleResultAndError(p.FetchActiveAccounts(query))
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例3: DeleteCreditCard

// DeleteCreditCard deletes the credit card of a group
func DeleteCreditCard(u *url.URL, h http.Header, _ interface{}, context *models.Context) (int, http.Header, interface{}, error) {
	if err := context.IsGroupAdmin(); err != nil {
		return response.NewBadRequest(err)
	}

	if err := payment.DeleteCreditCardForGroup(context.GroupName); err != nil {
		return response.NewBadRequest(err)
	}

	return response.NewDefaultOK()
}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例4: CreateCustomer

// CreateCustomer creates the customer for a group
func CreateCustomer(u *url.URL, h http.Header, req *stripe.CustomerParams, context *models.Context) (int, http.Header, interface{}, error) {
	if err := context.IsGroupAdmin(); err != nil {
		return response.NewBadRequest(err)
	}

	return response.HandleResultAndError(
		payment.EnsureCustomerForGroup(
			context.Client.Account.Nick,
			context.GroupName,
			req,
		),
	)
}
开发者ID:,项目名称:,代码行数:14,代码来源:

示例5: Info

// Info return usage info for a group
func Info(u *url.URL, h http.Header, _ interface{}, context *models.Context) (int, http.Header, interface{}, error) {
	if err := context.IsGroupAdmin(); err != nil {
		return response.NewBadRequest(err)
	}

	group, err := modelhelper.GetGroup(context.GroupName)
	if err != nil {
		return response.NewBadRequest(err)
	}

	return response.HandleResultAndError(
		payment.EnsureInfoForGroup(group, context.Client.Account.Nick),
	)
}
开发者ID:,项目名称:,代码行数:15,代码来源:

示例6: DeleteCustomer

// DeleteCustomer deletes customer for a group. Here for symmetry.
func DeleteCustomer(u *url.URL, h http.Header, _ interface{}, context *models.Context) (int, http.Header, interface{}, error) {
	// do not allow customer deletion, causes losing track of transactions.
	return http.StatusForbidden, nil, nil, nil

	if err := context.IsGroupAdmin(); err != nil {
		return response.NewBadRequest(err)
	}

	if err := payment.DeleteCustomerForGroup(context.GroupName); err != nil {
		return response.NewBadRequest(err)
	}

	return response.NewDeleted()
}
开发者ID:,项目名称:,代码行数:15,代码来源:

示例7: ListInvoice

// ListInvoice lists invoices of group
func ListInvoice(u *url.URL, h http.Header, _ interface{}, context *models.Context) (int, http.Header, interface{}, error) {
	if err := context.IsGroupAdmin(); err != nil {
		return response.NewBadRequest(err)
	}

	urlQuery := u.Query()
	limit, _ := strconv.Atoi(urlQuery.Get("limit"))
	if limit == 0 {
		limit = 10
	}

	return response.HandleResultAndError(
		payment.ListInvoicesForGroup(
			context.GroupName,
			urlQuery.Get("startingAfter"),
			limit,
		),
	)
}
开发者ID:,项目名称:,代码行数:20,代码来源:


注:本文中的socialapi/models.Context.IsGroupAdmin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。