Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security controller #138

Merged
merged 3 commits into from
Apr 4, 2018
Merged

Security controller #138

merged 3 commits into from
Apr 4, 2018

Conversation

alexandrebouthinon
Copy link
Member

  • char* createCredentials(char* strategy, char* id, char* body)
  • char* createFirstAdmin(char* body, options* options) // struct { char* _id; bool reset; } options;
  • Profile* createOrReplaceProfile(char* _id, char* body, options* options) // struct { bool refresh; } options;
  • Role* createOrReplaceRole(char* _id, char* body, options* options) // same options as profile
  • Profile* createProfile(char* _id, char* body, options* options)
  • char* createRestrictedUser(char* body, options* options) // struct { char* _id; bool refresh; } options;
  • Role* createRole(char* _id, char* body, options* options) // struct { bool refresh; } options;
  • char* createUser(char* body, options* options) // struct { char* _id, bool refresh; } options;
  • void deleteCredentials(char* strategy, char* _id)
  • char* deleteProfile(char* _id, options* options) // struct { bool refresh; } options;
  • char* deleteRole(char* _id, options* options)
  • char* deleteUser(char* _id, options* options)
  • char* getAllCredentialFields()
  • char* getCredentialFields(char* strategy)
  • char* getCredentials(char* strategy, char* _id)
  • char* getCredentialsById(char* strategy, char* _id)
  • Profile* getProfile(char* _id)
  • char* getProfileMapping()
  • char* getProfileRights(char* _id)
  • Role* getRole(char* _id)
  • char* getRoleMapping()
  • User* getUser(char* _id)
  • char* getUserMapping()
  • char* getUserRights(char* _id)
  • bool hasCredentials(char* strategy, char* _id)
  • char** mDeleteCredentials(char** ids, options* options) // struct { bool refresh; } options;
  • char** mDeleteRoles(char** ids, options* options)
  • char** mDeleteUsers(char** ids, options* options)
  • Profile** mGetProfiles(char** ids)
  • Role** mGetRoles(char** ids)
  • User* replaceUser(char* _id, char* content, options* options) // struct { bool refresh; } options;
  • ̀ SearchProfilesResult* searchProfiles(char** roles, options* options) // struct { int from; int size; char* scroll; } options;`
  • SearchRolesResult* searchRoles(char** controllers, options* options) // struct { int from; int size; } options;
  • SearchUsersResult* searchUsers(char* body, options* options) // struct { int from; int size; char* scroll; } options;
  • char* updateCredentials(char* strategy, char* _id, char* body)
  • Profile* updateProfile(char *_id, char* body; options* options) // struct { bool refresh; } options;
  • void updateProfileMapping(char* body)
  • Role* updateRole(char* _id, char* body; options* options)
  • void updateRoleMapping(char* body)
  • User* updateUser(char* _id, char* body, options* options) // struct { bool refresh; } options;
  • void updateUserMapping(char* body)
  • bool validateCredentials(char* strategy, char* _id, char* body)

@codecov-io
Copy link

codecov-io commented Mar 27, 2018

Codecov Report

Merging #138 into 1.x will increase coverage by 0.3%.
The diff coverage is 96.31%.

Impacted file tree graph

@@            Coverage Diff            @@
##              1.x     #138     +/-   ##
=========================================
+ Coverage   89.05%   89.35%   +0.3%     
=========================================
  Files         216      239     +23     
  Lines        3993     4256    +263     
=========================================
+ Hits         3556     3803    +247     
- Misses        410      429     +19     
+ Partials       27       24      -3
Impacted Files Coverage Δ
security/user.go 0% <0%> (-98.15%) ⬇️
security/profile.go 0% <0%> (-94.6%) ⬇️
security/role.go 0% <0%> (-94.12%) ⬇️
security/createCredentials.go 100% <100%> (ø)
security/mDeleteRoles.go 100% <100%> (ø)
security/mGetRoles.go 100% <100%> (ø)
security/getRole.go 100% <100%> (ø)
security/getAllCredentialFields.go 100% <100%> (ø)
security/mGetProfiles.go 100% <100%> (ø)
security/createRole.go 100% <100%> (ø)
... and 77 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 29965aa...141b45d. Read the comment docs.

security/user.go Outdated
Id string
Content map[string]interface{}
Id string `json:"_id"`
Content map[string]interface{} `json:"_source"`
ProfileIds []string
Security *Security
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need Security in the User object anymore. It should be a POJO

security/role.go Outdated
func (s *Security) NewRole(id string, controllers *types.Controllers) *Role {
r := &Role{
Id: id,
Security: s,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need Security in the Role object anymore, it should be a POJO

return &Profile{
Id: id,
Policies: policies,
Security: s,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need Security anymore, it should be a POJO

)

// CreateCredentials create credentials of the specified strategy with given body infos.
func (s *Security) CreateCredentials(strategy, id, body string, options types.QueryOptions) (json.RawMessage, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

body should be a json.RawMessage

)

// CreateFirstAdmin create credentials of the specified strategy with given body infos.
func (s *Security) CreateFirstAdmin(body string, options types.QueryOptions) (json.RawMessage, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

body should be a json.RawMessage


C.free(unsafe.Pointer(u))
//export kuzzle_security_get_credential_by_id
func kuzzle_security_get_credential_by_id(k *C.kuzzle, strategy, id *C.char, o *C.query_options) *C.json_result {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not use json_result anymore but string_result as we use char* for json now


return goToCUserResult(u.kuzzle, res, err)
//export kuzzle_security_create_user
func kuzzle_security_create_user(k *C.kuzzle, body *C.char, o *C.query_options) *C.json_result {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not use json_result anymore but string_result as we use char* for json now

res, err := cToGoUser(u).Delete(SetQueryOptions(o))
return goToCStringResult(&res, err)
//export kuzzle_security_create_credentials
func kuzzle_security_create_credentials(k *C.kuzzle, cstrategy, id, body *C.char, o *C.query_options) *C.json_result {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not use json_result anymore but string_result as we use char* for json now

res, err := cToGoUser(u).DeleteCredentials(C.GoString(strategy), SetQueryOptions(o))
return goToCBoolResult(res, err)
//export kuzzle_security_create_restricted_user
func kuzzle_security_create_restricted_user(k *C.kuzzle, body *C.char, o *C.query_options) *C.json_result {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not use json_result anymore but string_result as we use char* for json now

func kuzzle_security_user_get_credentials_info(u *C.user, strategy *C.char, o *C.query_options) *C.json_result {
res, err := cToGoUser(u).GetCredentialsInfo(C.GoString(strategy), SetQueryOptions(o))
//export kuzzle_security_create_first_admin
func kuzzle_security_create_first_admin(k *C.kuzzle, body *C.char, o *C.query_options) *C.json_result {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not use json_result anymore but string_result as we use char* for json now

@jenow jenow merged commit e118d1c into 1.x Apr 4, 2018
@jenow jenow deleted the security-controller branch April 4, 2018 09:54
@jenow jenow mentioned this pull request Sep 10, 2018
@jenow jenow mentioned this pull request Jun 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants