本文整理匯總了Golang中github.com/kidstuff/auth/authmodel.Manager.AddGroupDetail方法的典型用法代碼示例。如果您正苦於以下問題:Golang Manager.AddGroupDetail方法的具體用法?Golang Manager.AddGroupDetail怎麽用?Golang Manager.AddGroupDetail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/kidstuff/auth/authmodel.Manager
的用法示例。
在下文中一共展示了Manager.AddGroupDetail方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: testManagerAddGroupDetail
// testManagerAddGroupDetail simply check if the create group operation work.
func testManagerAddGroupDetail(t *testing.T, mngr authmodel.Manager) string {
info := authmodel.GroupInfo{}
desc := "testing privelege"
info.Description = &desc
g1, err := mngr.AddGroupDetail("staff", []string{"testing"}, &info)
if err != nil {
t.Fatal("cannot create new group:", err)
}
_, err = mngr.AddGroupDetail("staff", nil, nil)
if err == nil {
t.Fatal("must check for duplicated group name")
}
g1, err = mngr.FindGroup(*g1.Id)
if err != nil {
t.Fatal("cannot created group:", err)
}
if len(g1.Privileges) != 1 {
t.Fatal("add group privilege failed")
}
if g1.Privileges[0] != "testing" {
t.Fatal("add group privilege failed")
}
if g1.Info == nil || g1.Info.Description == nil || *g1.Info.Description != desc {
t.Fatal("add group info failed")
}
return *g1.Id
}