feat: fix comment and configs for successfully generating OpenAPI typescript-axios sdk (#2560)

* fix: fix swagger.json, successfully generate java sdk

* fix:fix comment and change some content for successfully generating typescript-axios sdk
This commit is contained in:
xiao-kong-long 2023-12-29 15:12:40 +08:00 committed by GitHub
parent c4819602ec
commit e7c015f288
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 338 additions and 150 deletions

View File

@ -56,6 +56,17 @@ type Captcha struct {
SubType string `json:"subType"`
}
// this API is used by "Api URL" of Flarum's FoF Passport plugin
// https://github.com/FriendsOfFlarum/passport
type LaravelResponse struct {
Id string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
EmailVerifiedAt string `json:"email_verified_at"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
// Signup
// @Tag Login API
// @Title Signup
@ -418,7 +429,7 @@ func (c *ApiController) GetUserinfo() {
// @Title UserInfo2
// @Tag Account API
// @Description return Laravel compatible user information according to OAuth 2.0
// @Success 200 {object} LaravelResponse The Response object
// @Success 200 {object} controllers.LaravelResponse The Response object
// @router /user [get]
func (c *ApiController) GetUserinfo2() {
user, ok := c.RequireSignedInUser()
@ -426,17 +437,6 @@ func (c *ApiController) GetUserinfo2() {
return
}
// this API is used by "Api URL" of Flarum's FoF Passport plugin
// https://github.com/FriendsOfFlarum/passport
type LaravelResponse struct {
Id string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
EmailVerifiedAt string `json:"email_verified_at"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
response := LaravelResponse{
Id: user.Id,
Name: user.Name,

View File

@ -222,7 +222,7 @@ func (c *ApiController) HandleLoggedIn(application *object.Application, user *ob
// @Param redirectUri query string true "redirect uri"
// @Param scope query string true "scope"
// @Param state query string true "state"
// @Success 200 {object} Response The Response object
// @Success 200 {object} controllers.Response The Response object
// @router /get-app-login [get]
func (c *ApiController) GetApplicationLogin() {
clientId := c.Input().Get("clientId")

View File

@ -26,7 +26,7 @@ import (
// @Title Enforce
// @Tag Enforce API
// @Description Call Casbin Enforce API
// @Param body body object.CasbinRequest true "Casbin request"
// @Param body body []string true "Casbin request"
// @Param permissionId query string false "permission id"
// @Param modelId query string false "model id"
// @Param resourceId query string false "resource id"
@ -43,7 +43,7 @@ func (c *ApiController) Enforce() {
return
}
var request object.CasbinRequest
var request []string
err := json.Unmarshal(c.Ctx.Input.RequestBody, &request)
if err != nil {
c.ResponseError(err.Error())
@ -60,7 +60,10 @@ func (c *ApiController) Enforce() {
res := []bool{}
keyRes := []string{}
enforceResult, err := enforcer.Enforce(request...)
// type transformation
interfaceRequest := util.StringToInterfaceArray(request)
enforceResult, err := enforcer.Enforce(interfaceRequest...)
if err != nil {
c.ResponseError(err.Error())
return
@ -87,7 +90,7 @@ func (c *ApiController) Enforce() {
res := []bool{}
keyRes := []string{}
enforceResult, err := object.Enforce(permission, &request)
enforceResult, err := object.Enforce(permission, request)
if err != nil {
c.ResponseError(err.Error())
return
@ -129,7 +132,7 @@ func (c *ApiController) Enforce() {
return
}
enforceResult, err := object.Enforce(firstPermission, &request, permissionIds...)
enforceResult, err := object.Enforce(firstPermission, request, permissionIds...)
if err != nil {
c.ResponseError(err.Error())
return
@ -146,7 +149,7 @@ func (c *ApiController) Enforce() {
// @Title BatchEnforce
// @Tag Enforce API
// @Description Call Casbin BatchEnforce API
// @Param body body object.CasbinRequest true "array of casbin requests"
// @Param body body []string true "array of casbin requests"
// @Param permissionId query string false "permission id"
// @Param modelId query string false "model id"
// @Success 200 {object} controllers.Response The Response object
@ -156,7 +159,7 @@ func (c *ApiController) BatchEnforce() {
modelId := c.Input().Get("modelId")
enforcerId := c.Input().Get("enforcerId")
var requests []object.CasbinRequest
var requests [][]string
err := json.Unmarshal(c.Ctx.Input.RequestBody, &requests)
if err != nil {
c.ResponseError(err.Error())
@ -173,7 +176,10 @@ func (c *ApiController) BatchEnforce() {
res := [][]bool{}
keyRes := []string{}
enforceResult, err := enforcer.BatchEnforce(requests)
// type transformation
interfaceRequests := util.StringToInterfaceArray2d(requests)
enforceResult, err := enforcer.BatchEnforce(interfaceRequests)
if err != nil {
c.ResponseError(err.Error())
return
@ -200,7 +206,7 @@ func (c *ApiController) BatchEnforce() {
res := [][]bool{}
keyRes := []string{}
enforceResult, err := object.BatchEnforce(permission, &requests)
enforceResult, err := object.BatchEnforce(permission, requests)
if err != nil {
c.ResponseError(err.Error())
return
@ -236,7 +242,7 @@ func (c *ApiController) BatchEnforce() {
return
}
enforceResult, err := object.BatchEnforce(firstPermission, &requests, permissionIds...)
enforceResult, err := object.BatchEnforce(firstPermission, requests, permissionIds...)
if err != nil {
c.ResponseError(err.Error())
return

View File

@ -138,7 +138,7 @@ func (c *ApiController) AddEnforcer() {
// @Title DeleteEnforcer
// @Tag Enforcer API
// @Description delete enforcer
// @Param body body object.Enforce true "The enforcer object"
// @Param body body object.Enforcer true "The enforcer object"
// @Success 200 {object} object.Enforcer
// @router /delete-enforcer [post]
func (c *ApiController) DeleteEnforcer() {

View File

@ -42,7 +42,7 @@ type LdapSyncResp struct {
// @Tag Account API
// @Description get ldap users
// Param id string true "id"
// @Success 200 {object} LdapResp The Response object
// @Success 200 {object} controllers.LdapResp The Response object
// @router /get-ldap-users [get]
func (c *ApiController) GetLdapUsers() {
id := c.Input().Get("id")
@ -250,7 +250,7 @@ func (c *ApiController) DeleteLdap() {
// @Tag Account API
// @Description sync ldap users
// @Param id query string true "id"
// @Success 200 {object} LdapSyncResp The Response object
// @Success 200 {object} controllers.LdapSyncResp The Response object
// @router /sync-ldap-users [post]
func (c *ApiController) SyncLdapUsers() {
id := c.Input().Get("id")

View File

@ -73,7 +73,7 @@ func (c *ApiController) MfaSetupInitiate() {
// @Description setup verify totp
// @param secret form string true "MFA secret"
// @param passcode form string true "MFA passcode"
// @Success 200 {object} Response object
// @Success 200 {object} controllers.Response The Response object
// @router /mfa/setup/verify [post]
func (c *ApiController) MfaSetupVerify() {
mfaType := c.Ctx.Request.Form.Get("mfaType")
@ -104,7 +104,7 @@ func (c *ApiController) MfaSetupVerify() {
// @param owner form string true "owner of user"
// @param name form string true "name of user"
// @param type form string true "MFA auth type"
// @Success 200 {object} Response object
// @Success 200 {object} controllers.Response The Response object
// @router /mfa/setup/enable [post]
func (c *ApiController) MfaSetupEnable() {
owner := c.Ctx.Request.Form.Get("owner")
@ -143,7 +143,7 @@ func (c *ApiController) MfaSetupEnable() {
// @Description: Delete MFA
// @param owner form string true "owner of user"
// @param name form string true "name of user"
// @Success 200 {object} Response object
// @Success 200 {object} controllers.Response The Response object
// @router /delete-mfa/ [post]
func (c *ApiController) DeleteMfa() {
owner := c.Ctx.Request.Form.Get("owner")
@ -176,7 +176,7 @@ func (c *ApiController) DeleteMfa() {
// @param owner form string true "owner of user"
// @param name form string true "name of user"
// @param id form string true "id of user's MFA props"
// @Success 200 {object} Response object
// @Success 200 {object} controllers.Response The Response object
// @router /set-preferred-mfa [post]
func (c *ApiController) SetPreferredMfa() {
mfaType := c.Ctx.Request.Form.Get("mfaType")

View File

@ -178,7 +178,7 @@ func (c *ApiController) DeleteOrganization() {
// @Tag Organization API
// @Description get default application
// @Param id query string true "organization id"
// @Success 200 {object} Response The Response object
// @Success 200 {object} controllers.Response The Response object
// @router /get-default-application [get]
func (c *ApiController) GetDefaultApplication() {
userId := c.GetSessionUsername()

View File

@ -51,7 +51,7 @@ type NotificationForm struct {
// @Param clientId query string true "The clientId of the application"
// @Param clientSecret query string true "The clientSecret of the application"
// @Param from body controllers.EmailForm true "Details of the email request"
// @Success 200 {object} Response object
// @Success 200 {object} controllers.Response The Response object
// @router /api/send-email [post]
func (c *ApiController) SendEmail() {
var emailForm EmailForm
@ -128,7 +128,7 @@ func (c *ApiController) SendEmail() {
// @Param clientId query string true "The clientId of the application"
// @Param clientSecret query string true "The clientSecret of the application"
// @Param from body controllers.SmsForm true "Details of the sms request"
// @Success 200 {object} Response object
// @Success 200 {object} controllers.Response The Response object
// @router /api/send-sms [post]
func (c *ApiController) SendSms() {
provider, err := c.GetProviderFromContext("SMS")
@ -166,7 +166,7 @@ func (c *ApiController) SendSms() {
// @Tag Service API
// @Description This API is not for Casdoor frontend to call, it is for Casdoor SDKs.
// @Param from body controllers.NotificationForm true "Details of the notification request"
// @Success 200 {object} Response object
// @Success 200 {object} controllers.Response The Response object
// @router /api/send-notification [post]
func (c *ApiController) SendNotification() {
provider, err := c.GetProviderFromContext("Notification")

View File

@ -284,24 +284,28 @@ func removeGroupingPolicies(permission *Permission) error {
return nil
}
type CasbinRequest = []interface{}
func Enforce(permission *Permission, request *CasbinRequest, permissionIds ...string) (bool, error) {
func Enforce(permission *Permission, request []string, permissionIds ...string) (bool, error) {
enforcer, err := getPermissionEnforcer(permission, permissionIds...)
if err != nil {
return false, err
}
return enforcer.Enforce(*request...)
// type transformation
interfaceRequest := util.StringToInterfaceArray(request)
return enforcer.Enforce(interfaceRequest...)
}
func BatchEnforce(permission *Permission, requests *[]CasbinRequest, permissionIds ...string) ([]bool, error) {
func BatchEnforce(permission *Permission, requests [][]string, permissionIds ...string) ([]bool, error) {
enforcer, err := getPermissionEnforcer(permission, permissionIds...)
if err != nil {
return nil, err
}
return enforcer.BatchEnforce(*requests)
// type transformation
interfaceRequests := util.StringToInterfaceArray2d(requests)
return enforcer.BatchEnforce(interfaceRequests)
}
func getAllValues(userId string, fn func(enforcer *casbin.Enforcer) []string) ([]string, error) {

View File

@ -811,9 +811,9 @@
],
"responses": {
"200": {
"description": "object",
"description": "The Response object",
"schema": {
"$ref": "#/definitions/Response"
"$ref": "#/definitions/controllers.Response"
}
}
}
@ -839,9 +839,9 @@
],
"responses": {
"200": {
"description": "object",
"description": "The Response object",
"schema": {
"$ref": "#/definitions/Response"
"$ref": "#/definitions/controllers.Response"
}
}
}
@ -881,9 +881,9 @@
],
"responses": {
"200": {
"description": "object",
"description": "The Response object",
"schema": {
"$ref": "#/definitions/Response"
"$ref": "#/definitions/controllers.Response"
}
}
}
@ -935,7 +935,10 @@
"description": "array of casbin requests",
"required": true,
"schema": {
"$ref": "#/definitions/object.CasbinRequest"
"type": "array",
"items": {
"type": "string"
}
}
},
{
@ -1108,7 +1111,7 @@
"description": "The enforcer object",
"required": true,
"schema": {
"$ref": "#/definitions/object.Enforce"
"$ref": "#/definitions/object.Enforcer"
}
}
],
@ -1187,9 +1190,9 @@
"operationId": "ApiController.DeleteMfa",
"responses": {
"200": {
"description": "object",
"description": "The Response object",
"schema": {
"$ref": "#/definitions/Response"
"$ref": "#/definitions/controllers.Response"
}
}
}
@ -1657,7 +1660,10 @@
"description": "Casbin request",
"required": true,
"schema": {
"$ref": "#/definitions/object.CasbinRequest"
"type": "array",
"items": {
"type": "string"
}
}
},
{
@ -1809,7 +1815,7 @@
"200": {
"description": "The Response object",
"schema": {
"$ref": "#/definitions/Response"
"$ref": "#/definitions/controllers.Response"
}
}
}
@ -1962,7 +1968,7 @@
"200": {
"description": "The Response object",
"schema": {
"$ref": "#/definitions/Response"
"$ref": "#/definitions/controllers.Response"
}
}
}
@ -2208,7 +2214,7 @@
"200": {
"description": "The Response object",
"schema": {
"$ref": "#/definitions/LdapResp"
"$ref": "#/definitions/controllers.LdapResp"
}
}
}
@ -3826,9 +3832,9 @@
"operationId": "ApiController.MfaSetupEnable",
"responses": {
"200": {
"description": "object",
"description": "The Response object",
"schema": {
"$ref": "#/definitions/Response"
"$ref": "#/definitions/controllers.Response"
}
}
}
@ -3860,9 +3866,9 @@
"operationId": "ApiController.MfaSetupVerify",
"responses": {
"200": {
"description": "object",
"description": "The Response object",
"schema": {
"$ref": "#/definitions/Response"
"$ref": "#/definitions/controllers.Response"
}
}
}
@ -3996,9 +4002,9 @@
"operationId": "ApiController.SetPreferredMfa",
"responses": {
"200": {
"description": "object",
"description": "The Response object",
"schema": {
"$ref": "#/definitions/Response"
"$ref": "#/definitions/controllers.Response"
}
}
}
@ -4057,7 +4063,7 @@
"200": {
"description": "The Response object",
"schema": {
"$ref": "#/definitions/LdapSyncResp"
"$ref": "#/definitions/controllers.LdapSyncResp"
}
}
}
@ -4925,7 +4931,7 @@
"200": {
"description": "The Response object",
"schema": {
"$ref": "#/definitions/LaravelResponse"
"$ref": "#/definitions/controllers.LaravelResponse"
}
}
}
@ -5131,22 +5137,6 @@
}
},
"definitions": {
"LaravelResponse": {
"title": "LaravelResponse",
"type": "object"
},
"LdapResp": {
"title": "LdapResp",
"type": "object"
},
"LdapSyncResp": {
"title": "LdapSyncResp",
"type": "object"
},
"Response": {
"title": "Response",
"type": "object"
},
"casbin.Enforcer": {
"title": "Enforcer",
"type": "object"
@ -5179,6 +5169,66 @@
}
}
},
"controllers.LaravelResponse": {
"title": "LaravelResponse",
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"email": {
"type": "string"
},
"email_verified_at": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
"controllers.LdapResp": {
"title": "LdapResp",
"type": "object",
"properties": {
"existUuids": {
"type": "array",
"items": {
"type": "string"
}
},
"users": {
"type": "array",
"items": {
"$ref": "#/definitions/object.LdapUser"
}
}
}
},
"controllers.LdapSyncResp": {
"title": "LdapSyncResp",
"type": "object",
"properties": {
"exist": {
"type": "array",
"items": {
"$ref": "#/definitions/object.LdapUser"
}
},
"failed": {
"type": "array",
"items": {
"$ref": "#/definitions/object.LdapUser"
}
}
}
},
"controllers.NotificationForm": {
"title": "NotificationForm",
"type": "object",
@ -5236,10 +5286,6 @@
}
}
},
"jose.JSONWebKey": {
"title": "JSONWebKey",
"type": "object"
},
"model.Model": {
"title": "Model",
"type": "object"
@ -5368,6 +5414,14 @@
"type": "integer",
"format": "int64"
},
"failedSigninLimit": {
"type": "integer",
"format": "int64"
},
"failedSigninfrozenTime": {
"type": "integer",
"format": "int64"
},
"forgetUrl": {
"type": "string"
},
@ -5480,12 +5534,6 @@
}
}
},
"object.CasbinRequest": {
"title": "CasbinRequest",
"type": "array",
"items": {
}
},
"object.Cert": {
"title": "Cert",
"type": "object",
@ -5527,10 +5575,6 @@
}
}
},
"object.Enforce": {
"title": "Enforce",
"type": "object"
},
"object.Enforcer": {
"title": "Enforcer",
"type": "object",
@ -5771,6 +5815,66 @@
}
}
},
"object.LdapUser": {
"title": "LdapUser",
"type": "object",
"properties": {
"EmailAddress": {
"type": "string"
},
"Mail": {
"type": "string"
},
"MobileTelephoneNumber": {
"type": "string"
},
"PostalAddress": {
"type": "string"
},
"RegisteredAddress": {
"type": "string"
},
"TelephoneNumber": {
"type": "string"
},
"address": {
"type": "string"
},
"cn": {
"type": "string"
},
"displayName": {
"type": "string"
},
"email": {
"type": "string"
},
"gidNumber": {
"type": "string"
},
"groupId": {
"type": "string"
},
"memberOf": {
"type": "string"
},
"mobile": {
"type": "string"
},
"uid": {
"type": "string"
},
"uidNumber": {
"type": "string"
},
"userPrincipalName": {
"type": "string"
},
"uuid": {
"type": "string"
}
}
},
"object.ManagedAccount": {
"title": "ManagedAccount",
"type": "object",
@ -7529,22 +7633,6 @@
],
"example": "Paid"
},
"protocol.CredentialAssertion": {
"title": "CredentialAssertion",
"type": "object"
},
"protocol.CredentialAssertionResponse": {
"title": "CredentialAssertionResponse",
"type": "object"
},
"protocol.CredentialCreation": {
"title": "CredentialCreation",
"type": "object"
},
"protocol.CredentialCreationResponse": {
"title": "CredentialCreationResponse",
"type": "object"
},
"util.SystemInfo": {
"title": "SystemInfo",
"type": "object",

View File

@ -525,9 +525,9 @@ paths:
$ref: '#/definitions/controllers.EmailForm'
responses:
"200":
description: object
description: The Response object
schema:
$ref: '#/definitions/Response'
$ref: '#/definitions/controllers.Response'
/api/api/send-notification:
post:
tags:
@ -543,9 +543,9 @@ paths:
$ref: '#/definitions/controllers.NotificationForm'
responses:
"200":
description: object
description: The Response object
schema:
$ref: '#/definitions/Response'
$ref: '#/definitions/controllers.Response'
/api/api/send-sms:
post:
tags:
@ -571,9 +571,9 @@ paths:
$ref: '#/definitions/controllers.SmsForm'
responses:
"200":
description: object
description: The Response object
schema:
$ref: '#/definitions/Response'
$ref: '#/definitions/controllers.Response'
/api/api/verify-code:
post:
tags:
@ -606,7 +606,9 @@ paths:
description: array of casbin requests
required: true
schema:
$ref: '#/definitions/object.CasbinRequest'
type: array
items:
type: string
- in: query
name: permissionId
description: permission id
@ -718,7 +720,7 @@ paths:
description: The enforcer object
required: true
schema:
$ref: '#/definitions/object.Enforce'
$ref: '#/definitions/object.Enforcer'
responses:
"200":
description: ""
@ -768,9 +770,9 @@ paths:
operationId: ApiController.DeleteMfa
responses:
"200":
description: object
description: The Response object
schema:
$ref: '#/definitions/Response'
$ref: '#/definitions/controllers.Response'
/api/delete-model:
post:
tags:
@ -1071,7 +1073,9 @@ paths:
description: Casbin request
required: true
schema:
$ref: '#/definitions/object.CasbinRequest'
type: array
items:
type: string
- in: query
name: permissionId
description: permission id
@ -1172,7 +1176,7 @@ paths:
"200":
description: The Response object
schema:
$ref: '#/definitions/Response'
$ref: '#/definitions/controllers.Response'
/api/get-application:
get:
tags:
@ -1272,7 +1276,7 @@ paths:
"200":
description: The Response object
schema:
$ref: '#/definitions/Response'
$ref: '#/definitions/controllers.Response'
/api/get-email-and-phone:
get:
tags:
@ -1433,7 +1437,7 @@ paths:
"200":
description: The Response object
schema:
$ref: '#/definitions/LdapResp'
$ref: '#/definitions/controllers.LdapResp'
/api/get-ldaps:
get:
tags:
@ -2496,9 +2500,9 @@ paths:
operationId: ApiController.MfaSetupEnable
responses:
"200":
description: object
description: The Response object
schema:
$ref: '#/definitions/Response'
$ref: '#/definitions/controllers.Response'
/api/mfa/setup/initiate:
post:
tags:
@ -2518,9 +2522,9 @@ paths:
operationId: ApiController.MfaSetupVerify
responses:
"200":
description: object
description: The Response object
schema:
$ref: '#/definitions/Response'
$ref: '#/definitions/controllers.Response'
/api/notify-payment:
post:
tags:
@ -2607,9 +2611,9 @@ paths:
operationId: ApiController.SetPreferredMfa
responses:
"200":
description: object
description: The Response object
schema:
$ref: '#/definitions/Response'
$ref: '#/definitions/controllers.Response'
/api/signup:
post:
tags:
@ -2648,7 +2652,7 @@ paths:
"200":
description: The Response object
schema:
$ref: '#/definitions/LdapSyncResp'
$ref: '#/definitions/controllers.LdapSyncResp'
/api/unlink:
post:
tags:
@ -3219,7 +3223,7 @@ paths:
"200":
description: The Response object
schema:
$ref: '#/definitions/LaravelResponse'
$ref: '#/definitions/controllers.LaravelResponse'
/api/userinfo:
get:
tags:
@ -3351,18 +3355,6 @@ paths:
schema:
$ref: '#/definitions/object.TokenError'
definitions:
LaravelResponse:
title: LaravelResponse
type: object
LdapResp:
title: LdapResp
type: object
LdapSyncResp:
title: LdapSyncResp
type: object
Response:
title: Response
type: object
casbin.Enforcer:
title: Enforcer
type: object
@ -3385,6 +3377,46 @@ definitions:
type: string
title:
type: string
controllers.LaravelResponse:
title: LaravelResponse
type: object
properties:
created_at:
type: string
email:
type: string
email_verified_at:
type: string
id:
type: string
name:
type: string
updated_at:
type: string
controllers.LdapResp:
title: LdapResp
type: object
properties:
existUuids:
type: array
items:
type: string
users:
type: array
items:
$ref: '#/definitions/object.LdapUser'
controllers.LdapSyncResp:
title: LdapSyncResp
type: object
properties:
exist:
type: array
items:
$ref: '#/definitions/object.LdapUser'
failed:
type: array
items:
$ref: '#/definitions/object.LdapUser'
controllers.NotificationForm:
title: NotificationForm
type: object
@ -3514,6 +3546,12 @@ definitions:
expireInHours:
type: integer
format: int64
failedSigninLimit:
type: integer
format: int64
failedSigninfrozenTime:
type: integer
format: int64
forgetUrl:
type: string
formBackgroundUrl:
@ -3588,11 +3626,6 @@ definitions:
$ref: '#/definitions/object.ThemeData'
tokenFormat:
type: string
object.CasbinRequest:
title: CasbinRequest
type: array
items:
$ref: '#/definitions/object.CasbinRequest'
object.Cert:
title: Cert
type: object
@ -3621,9 +3654,6 @@ definitions:
type: string
type:
type: string
object.Enforce:
title: Enforce
type: object
object.Enforcer:
title: Enforcer
type: object
@ -3786,6 +3816,46 @@ definitions:
type: string
username:
type: string
object.LdapUser:
title: LdapUser
type: object
properties:
EmailAddress:
type: string
Mail:
type: string
MobileTelephoneNumber:
type: string
PostalAddress:
type: string
RegisteredAddress:
type: string
TelephoneNumber:
type: string
address:
type: string
cn:
type: string
displayName:
type: string
email:
type: string
gidNumber:
type: string
groupId:
type: string
memberOf:
type: string
mobile:
type: string
uid:
type: string
uidNumber:
type: string
userPrincipalName:
type: string
uuid:
type: string
object.ManagedAccount:
title: ManagedAccount
type: object

View File

@ -322,3 +322,23 @@ func GetUsernameFromEmail(email string) string {
return tokens[0]
}
}
func StringToInterfaceArray(array []string) []interface{} {
var interfaceArray []interface{}
for _, v := range array {
interfaceArray = append(interfaceArray, v)
}
return interfaceArray
}
func StringToInterfaceArray2d(arrays [][]string) [][]interface{} {
var interfaceArrays [][]interface{}
for _, req := range arrays {
var interfaceArray []interface{}
for _, r := range req {
interfaceArray = append(interfaceArray, r)
}
interfaceArrays = append(interfaceArrays, interfaceArray)
}
return interfaceArrays
}