本文整理匯總了Golang中github.com/cloudawan/cloudone_utility/rbac.User.HasChildPermission方法的典型用法代碼示例。如果您正苦於以下問題:Golang User.HasChildPermission方法的具體用法?Golang User.HasChildPermission怎麽用?Golang User.HasChildPermission使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudawan/cloudone_utility/rbac.User
的用法示例。
在下文中一共展示了User.HasChildPermission方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: GetLayoutMenu
func GetLayoutMenu(user *rbac.User) string {
if user == nil {
return ""
}
buffer := bytes.Buffer{}
buffer.WriteByte('\n')
// Dashboard
if user.HasChildPermission(componentName, "GET", "/gui/dashboard") {
buffer.WriteString(" <li class=''><a href='/gui/dashboard/topology'>Dashboard</a></li>\n")
}
// Repository
// Parent
if user.HasChildPermission(componentName, "GET", "/gui/repository") {
buffer.WriteString(" <li class='dropdown'>\n")
buffer.WriteString(" <a href='#' class='dropdown-toggle' data-toggle='dropdown' role='button' aria-expanded='false'>Repository<span class='caret'></span></a>\n")
buffer.WriteString(" <ul class='dropdown-menu' role='menu'>\n")
}
// Child
if user.HasPermission(componentName, "GET", "/gui/repository/imageinformation/list") {
buffer.WriteString(" <li><a href='/gui/repository/imageinformation/list'>Applications</a></li>\n")
}
if user.HasPermission(componentName, "GET", "/gui/repository/thirdparty/list") {
buffer.WriteString(" <li><a href='/gui/repository/thirdparty/list'>Third-party Services</a></li>\n")
}
if user.HasPermission(componentName, "GET", "/gui/repository/topologytemplate/list") {
buffer.WriteString(" <li><a href='/gui/repository/topologytemplate/list'>Topology template</a></li>\n")
}
// Parent
if user.HasChildPermission(componentName, "GET", "/gui/repository") {
buffer.WriteString(" </ul>\n")
buffer.WriteString(" </li>\n")
}
// Deploy
// Parent
if user.HasChildPermission(componentName, "GET", "/gui/deploy") {
buffer.WriteString(" <li class='dropdown'>\n")
buffer.WriteString(" <a href='#' class='dropdown-toggle' data-toggle='dropdown' role='button' aria-expanded='false'>Deploy<span class='caret'></span></a>\n")
buffer.WriteString(" <ul class='dropdown-menu' role='menu'>\n")
}
// Child
if user.HasPermission(componentName, "GET", "/gui/deploy/deploy/list") {
buffer.WriteString(" <li><a href='/gui/deploy/deploy/list'>Applications</a></li>\n")
}
if user.HasPermission(componentName, "GET", "/gui/deploy/deploybluegreen/list") {
buffer.WriteString(" <li><a href='/gui/deploy/deploybluegreen/list'>Blue Green Deployments</a></li>\n")
}
if user.HasPermission(componentName, "GET", "/gui/deploy/autoscaler/list") {
buffer.WriteString(" <li><a href='/gui/deploy/autoscaler/list'>Autoscalers</a></li>\n")
}
if user.HasPermission(componentName, "GET", "/gui/deploy/deployclusterapplication/list") {
buffer.WriteString(" <li><a href='/gui/deploy/deployclusterapplication/list'>Third-party Services</a></li>\n")
}
if user.HasPermission(componentName, "GET", "/gui/deploy/clone/topology") {
buffer.WriteString(" <li><a href='/gui/deploy/clone/select'>Clone Topology</a></li>\n")
}
// Parent
if user.HasChildPermission(componentName, "GET", "/gui/deploy") {
buffer.WriteString(" </ul>\n")
buffer.WriteString(" </li>\n")
}
// Inventory
// Parent
if user.HasChildPermission(componentName, "GET", "/gui/inventory") {
buffer.WriteString(" <li class='dropdown'>\n")
buffer.WriteString(" <a href='#' class='dropdown-toggle' data-toggle='dropdown' role='button' aria-expanded='false'>Inventory<span class='caret'></span></a>\n")
buffer.WriteString(" <ul class='dropdown-menu' role='menu'>\n")
}
// Child
if user.HasPermission(componentName, "GET", "/gui/inventory/replicationcontroller/list") {
buffer.WriteString(" <li><a href='/gui/inventory/replicationcontroller/list'>Replications</a></li>\n")
}
if user.HasPermission(componentName, "GET", "/gui/inventory/service/list") {
buffer.WriteString(" <li><a href='/gui/inventory/service/list'>Services</a></li>\n")
}
// Parent
if user.HasChildPermission(componentName, "GET", "/gui/inventory") {
buffer.WriteString(" </ul>\n")
buffer.WriteString(" </li>\n")
}
// Filesystem
// Parent
if user.HasChildPermission(componentName, "GET", "/gui/filesystem") {
buffer.WriteString(" <li class='dropdown'>\n")
buffer.WriteString(" <a href='#' class='dropdown-toggle' data-toggle='dropdown' role='button' aria-expanded='false'>Filesystem<span class='caret'></span></a>\n")
buffer.WriteString(" <ul class='dropdown-menu' role='menu'>\n")
}
// Child
if user.HasPermission(componentName, "GET", "/gui/filesystem/glusterfs/cluster/list") {
buffer.WriteString(" <li><a href='/gui/filesystem/glusterfs/cluster/list'>Glusterfs</a></li>\n")
}
// Parent
if user.HasChildPermission(componentName, "GET", "/gui/filesystem") {
buffer.WriteString(" </ul>\n")
buffer.WriteString(" </li>\n")
//.........這裏部分代碼省略.........