This repository has been archived by the owner on Oct 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sergio Garcia Ruiz
committed
Nov 10, 2016
1 parent
ec76991
commit 3e9f51d
Showing
4 changed files
with
80 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package api | ||
|
||
import ( | ||
"encoding/json" | ||
"strings" | ||
|
||
internalhttp "github.com/Tecsisa/foulkon/http" | ||
) | ||
|
||
func (c *ClientAPI) GetAuthorizedResources(action, resources string) (string, error) { | ||
numResources := strings.Count("resources", ",") + 1 | ||
resourcesJson := make([]string, numResources) | ||
if err := json.Unmarshal([]byte(resources), &resourcesJson); err != nil { | ||
return "", err | ||
} | ||
body := map[string]interface{}{ | ||
"action": action, | ||
"resources": resourcesJson, | ||
} | ||
|
||
req, err := c.prepareRequest("POST", internalhttp.RESOURCE_URL, body, nil) | ||
if err != nil { | ||
return "", err | ||
} | ||
return c.makeRequest(req) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters