-
Notifications
You must be signed in to change notification settings - Fork 5
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
Security controller #138
Conversation
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
security/user.go
Outdated
Id string | ||
Content map[string]interface{} | ||
Id string `json:"_id"` | ||
Content map[string]interface{} `json:"_source"` | ||
ProfileIds []string | ||
Security *Security |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
security/profile.go
Outdated
return &Profile{ | ||
Id: id, | ||
Policies: policies, | ||
Security: s, |
There was a problem hiding this comment.
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
security/createCredentials.go
Outdated
) | ||
|
||
// 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) { |
There was a problem hiding this comment.
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
security/createFirstAdmin.go
Outdated
) | ||
|
||
// CreateFirstAdmin create credentials of the specified strategy with given body infos. | ||
func (s *Security) CreateFirstAdmin(body string, options types.QueryOptions) (json.RawMessage, error) { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
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;
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)