本文整理汇总了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),
)
}
示例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))
}
示例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()
}
示例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,
),
)
}
示例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),
)
}
示例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()
}
示例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,
),
)
}