我有一个简单的Web表单,可以根据AD验证用户。 Tableau Server配置为使用AD,我希望使用Tableau REST API将具有“交互”角色的用户添加到Tableau Server。有没有一种简单的方法在C#.NET中执行此操作?这是代码隐藏:
tabcmd createuser ADname --license "interactor"
我知道根据http://onlinehelp.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm我想做的事情
object DataFrameUtils {
def dropSubColumn(col: Column, colType: DataType, fullColName: String, dropColName: String): Option[Column] = {
val colToKeep =
if (fullColName.equals(dropColName)) {
None
} else {
colType match {
case arrayType: ArrayType =>
arrayType.elementType match {
case elemType: StructType =>
if (dropColName.startsWith(s"$fullColName.")) {
val unDropdCols: Array[Column] = elemType.fields.flatMap(f =>
dropSubColumn(col.getField(f.name), f.dataType, s"$fullColName.${f.name}", dropColName) match {
case Some(x) => {
Some(x.alias(f.name))
}
case None => {
None
}
})
Some(array(struct(unDropdCols: _*)))
} else {
Some(col)
}
case other => {
Some(col)
}
}
case colType: StructType =>
if (dropColName.startsWith(s"$fullColName.")) {
val unDropdCols: Array[Column] = colType.fields.flatMap(f =>
dropSubColumn(col.getField(f.name), f.dataType, s"$fullColName.${f.name}", dropColName) match {
case Some(x) => {
Some(x.alias(f.name))
}
case None => None
})
Some(struct(unDropdCols: _*))
} else {
Some(col)
}
case other =>
Some(col)
}
}
colToKeep
}
def dropColumn(df: DataFrame, colToDropName: String): DataFrame = {
df.schema.fields
.flatMap(f => {
if (colToDropName.startsWith(s"${f.name}.")) {
dropSubColumn(col(f.name), f.dataType, f.name, colToDropName) match {
case Some(column) => Some((f.name, column))
case None => None
}
} else {
None
}
}).foldLeft(df.drop(colToDropName)) {
case (newDf, (colName, column)) => {
newDf.withColumn(colName, column)
}
}
}
}
但是我怎么能在C#中做到这一点?我遇到的问题包括解析正确的凭据以及如何将其发送到Tableau Server。
答案 0 :(得分:0)
在Tableau中使用AD身份验证时,您不应手动创建用户。有一种机制: https://onlinehelp.tableau.com/current/server/en-us/groups_globalsync.htm
它甚至允许您为新帐户设置角色。