Documentation ¶
Index ¶
- Constants
- type Controller
- func (controller *Controller) CanAccess(c *gin.Context)
- func (controller *Controller) CanDelete(c *gin.Context)
- func (controller *Controller) CanManage(c *gin.Context)
- func (controller *Controller) CanManageSpecial(c *gin.Context)
- func (controller *Controller) CanModify(c *gin.Context)
- func (controller *Controller) ConfigInviteLink(c *gin.Context)
- func (controller *Controller) CreateUser(c *gin.Context)
- func (controller *Controller) DeleteOldInvite(c *gin.Context, invite *model.Invite) error
- func (controller *Controller) DeleteUser(c *gin.Context)
- func (controller *Controller) DoesTeamInvitePermissionWasClosed(c *gin.Context, attrg *accesscontrol.AttributeGroup, team *model.Team) bool
- func (controller *Controller) EmailAlreadyUsedByTeamMember(c *gin.Context, email string, teamID int) (bool, *model.TeamMember)
- func (controller *Controller) FeedbackBadRequest(c *gin.Context, errorFlag int, errorMessage string)
- func (controller *Controller) FeedbackInternalServerError(c *gin.Context, errorFlag int, errorMessage string)
- func (controller *Controller) FeedbackInviteByEmail(c *gin.Context, invite *model.Invite)
- func (controller *Controller) FeedbackInviteByLink(c *gin.Context, invite *model.Invite)
- func (controller *Controller) FeedbackNewInviteByEmail(c *gin.Context, invite *model.Invite)
- func (controller *Controller) FeedbackOK(c *gin.Context, resp model.Response)
- func (controller *Controller) ForgetPassword(c *gin.Context)
- func (controller *Controller) GenerateInviteLink(c *gin.Context)
- func (controller *Controller) GetAllTeamMember(c *gin.Context)
- func (controller *Controller) GetIntParamFromRequest(c *gin.Context, paramName string) (int, error)
- func (controller *Controller) GetMagicIntParamFromRequest(c *gin.Context, paramName string) (int, error)
- func (controller *Controller) GetMyTeams(c *gin.Context)
- func (controller *Controller) GetStringParamFromHeader(c *gin.Context, paramName string) (string, error)
- func (controller *Controller) GetStringParamFromRequest(c *gin.Context, paramName string) (string, error)
- func (controller *Controller) GetTargetTeamByIdentifier(c *gin.Context)
- func (controller *Controller) GetTargetUserByInternalRequest(c *gin.Context)
- func (controller *Controller) GetTeamMember(c *gin.Context)
- func (controller *Controller) GetTeamPermission(c *gin.Context)
- func (controller *Controller) GetUserAvatarUploadAddress(c *gin.Context)
- func (controller *Controller) GetUserIDFromAuth(c *gin.Context) (int, error)
- func (controller *Controller) GetVerificationCode(c *gin.Context)
- func (controller *Controller) InviteMemberByEmail(c *gin.Context)
- func (controller *Controller) JoinByLink(c *gin.Context)
- func (controller *Controller) Logout(c *gin.Context)
- func (controller *Controller) RemoveTeamMember(c *gin.Context)
- func (controller *Controller) RenewInviteLink(c *gin.Context)
- func (controller *Controller) RetrieveUserByID(c *gin.Context)
- func (controller *Controller) SendInvite(c *gin.Context, invite *model.Invite, team *model.Team, user *model.User) error
- func (controller *Controller) SignIn(c *gin.Context)
- func (controller *Controller) SignUp(c *gin.Context)
- func (controller *Controller) Status(c *gin.Context)
- func (controller *Controller) StorageInvite(c *gin.Context, invite *model.Invite) error
- func (controller *Controller) StorageTeamMemberByEmailInvite(c *gin.Context, invite *model.Invite) error
- func (controller *Controller) TestMagicIntParamFromRequest(c *gin.Context, paramName string) (int, error)
- func (controller *Controller) UpdateAvatar(c *gin.Context)
- func (controller *Controller) UpdateInvite(c *gin.Context, invite *model.Invite) error
- func (controller *Controller) UpdateIsTutorialViewed(c *gin.Context)
- func (controller *Controller) UpdateLanguage(c *gin.Context)
- func (controller *Controller) UpdateNickname(c *gin.Context)
- func (controller *Controller) UpdatePassword(c *gin.Context)
- func (controller *Controller) UpdateTeamConfig(c *gin.Context)
- func (controller *Controller) UpdateTeamMember(c *gin.Context, teamMember *model.TeamMember) error
- func (controller *Controller) UpdateTeamMemberRole(c *gin.Context)
- func (controller *Controller) UpdateTeamPermission(c *gin.Context)
- func (controller *Controller) ValidateAccount(c *gin.Context)
- func (controller *Controller) ValidateRequestTokenFromHeader(c *gin.Context, input ...string) (bool, error)
Constants ¶
const ( // validate failed ERROR_FLAG_VALIDATE_ACCOUNT_FAILED = iota + 1 // start with 1 ERROR_FLAG_VALIDATE_REQUEST_BODY_FAILED ERROR_FLAG_VALIDATE_REQUEST_TOKEN_FAILED ERROR_FLAG_VALIDATE_REQUEST_PARAM_FAILED ERROR_FLAG_VALIDATE_VERIFICATION_CODE_FAILED ERROR_FLAG_PARSE_REQUEST_BODY_FAILED ERROR_FLAG_PARSE_REQUEST_URI_FAILED ERROR_FLAG_PARSE_INVITE_LINK_HASH_FAILED ERROR_FLAG_CAN_NOT_TRANSFER_OWNER_TO_PENDING_USER ERROR_FLAG_CAN_NOT_REMOVE_OWNER_FROM_TEAM ERROR_FLAG_SIGN_UP_EMAIL_MISMATCH ERROR_FLAG_OWNER_ROLE_MUST_BE_TRANSFERED ERROR_FLAG_PASSWORD_INVALIED ERROR_FLAG_TEAM_MUST_TRANSFERED_BEFORE_USER_SUSPEND ERROR_FLAG_INVITE_EMAIL_MISMATCH // can note create ERROR_FLAG_CAN_NOT_CREATE_USER ERROR_FLAG_CAN_NOT_CREATE_TEAM ERROR_FLAG_CAN_NOT_CREATE_TEAM_MEMBER ERROR_FLAG_CAN_NOT_CREATE_INVITE ERROR_FLAG_CAN_NOT_CREATE_INVITATION_CODE ERROR_FLAG_CAN_NOT_CREATE_DOMAIN ERROR_FLAG_CAN_NOT_CREATE_ACTION ERROR_FLAG_CAN_NOT_CREATE_RESOURCE ERROR_FLAG_CAN_NOT_CREATE_APP // can not get resource ERROR_FLAG_CAN_NOT_GET_USER ERROR_FLAG_CAN_NOT_GET_TEAM ERROR_FLAG_CAN_NOT_GET_TEAM_MEMBER ERROR_FLAG_CAN_NOT_GET_INVITE ERROR_FLAG_CAN_NOT_GET_INVITATION_CODE ERROR_FLAG_CAN_NOT_GET_DOMAIN ERROR_FLAG_CAN_NOT_GET_ACTION ERROR_FLAG_CAN_NOT_GET_RESOURCE ERROR_FLAG_CAN_NOT_GET_RESOURCE_META_INFO ERROR_FLAG_CAN_NOT_GET_APP ERROR_FLAG_CAN_NOT_GET_BUILDER_DESCRIPTION // can not update resource ERROR_FLAG_CAN_NOT_UPDATE_USER ERROR_FLAG_CAN_NOT_UPDATE_TEAM ERROR_FLAG_CAN_NOT_UPDATE_TEAM_MEMBER ERROR_FLAG_CAN_NOT_UPDATE_INVITE ERROR_FLAG_CAN_NOT_UPDATE_INVITATION_CODE ERROR_FLAG_CAN_NOT_UPDATE_DOMAIN ERROR_FLAG_CAN_NOT_UPDATE_ACTION ERROR_FLAG_CAN_NOT_UPDATE_RESOURCE ERROR_FLAG_CAN_NOT_UPDATE_APP // can not delete ERROR_FLAG_CAN_NOT_DELETE_USER ERROR_FLAG_CAN_NOT_DELETE_TEAM ERROR_FLAG_CAN_NOT_DELETE_TEAM_MEMBER ERROR_FLAG_CAN_NOT_DELETE_INVITE ERROR_FLAG_CAN_NOT_DELETE_INVITATION_CODE ERROR_FLAG_CAN_NOT_DELETE_DOMAIN ERROR_FLAG_CAN_NOT_DELETE_ACTION ERROR_FLAG_CAN_NOT_DELETE_RESOURCE ERROR_FLAG_CAN_NOT_DELETE_APP // can not other operation ERROR_FLAG_CAN_NOT_CHECK_TEAM_MEMBER ERROR_FLAG_CAN_NOT_DUPLICATE_APP ERROR_FLAG_CAN_NOT_RELEASE_APP ERROR_FLAG_CAN_NOT_TEST_RESOURCE_CONNECTION // permission failed ERROR_FLAG_ACCESS_DENIED ERROR_FLAG_TEAM_CLOSED_THE_PERMISSION ERROR_FLAG_EMAIL_ALREADY_USED ERROR_FLAG_EMAIL_HAS_BEEN_TAKEN ERROR_FLAG_INVITATION_CODE_ALREADY_USED ERROR_FLAG_INVITATION_LINK_UNAVALIABLE ERROR_FLAG_TEAM_IDENTIFIER_HAS_BEEN_TAKEN ERROR_FLAG_USER_ALREADY_JOINED_TEAM ERROR_FLAG_SIGN_IN_FAILED ERROR_FLAG_NO_SUCH_USER // call resource failed ERROR_FLAG_SEND_EMAIL_FAILED ERROR_FLAG_SEND_VERIFICATION_CODE_FAILED ERROR_FLAG_CREATE_LINK_FAILED ERROR_FLAG_CREATE_UPLOAD_URL_FAILED ERROR_FLAG_EXECUTE_ACTION_FAILED ERROR_FLAG_GENERATE_SQL_FAILED // internal failed ERROR_FLAG_BUILD_TEAM_MEMBER_LIST_FAILED ERROR_FLAG_BUILD_TEAM_CONFIG_FAILED ERROR_FLAG_BUILD_TEAM_PERMISSION_FAILED ERROR_FLAG_BUILD_USER_INFO_FAILED ERROR_FLAG_BUILD_APP_CONFIG_FAILED ERROR_FLAG_GENERATE_PASSWORD_FAILED )
const PARAM_APP_ID = "appID"
const PARAM_ATTRIBUTE_ID = "attributeID"
const PARAM_AUTHORIZATION_TOKEN = "Authorization-Token"
const PARAM_FILE_NAME = "fileName"
const PARAM_FROM_ID = "fromID"
const PARAM_INVITE_LINK_HASH = "inviteLinkHash"
const PARAM_REQUEST_TOKEN = "Request-Token"
const PARAM_TARGET_TEAM_IDENTIFIER = "teamIdentifier"
const PARAM_TARGET_TEAM_MEMBER_ID = "targetTeamMemberID"
const PARAM_TARGET_USER_ID = "targetUserID"
const PARAM_TEAM_ID = "teamID"
const PARAM_TO_ID = "toID"
const PARAM_UNIT_ID = "unitID"
const PARAM_UNIT_TYPE = "unitType"
const PARAM_USER_ID = "userID"
const PARAM_USER_ROLE = "userRole"
const PARAM_VERSION = "version"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct { Storage *model.Storage Cache *model.Cache Drive *model.Drive RequestTokenValidator *tokenvalidator.RequestTokenValidator Authenticator *authenticator.Authenticator }
func NewController ¶
func NewController(storage *model.Storage, cache *model.Cache, drive *model.Drive, validator *tokenvalidator.RequestTokenValidator, auth *authenticator.Authenticator) *Controller
func (*Controller) CanAccess ¶
func (controller *Controller) CanAccess(c *gin.Context)
func (*Controller) CanDelete ¶
func (controller *Controller) CanDelete(c *gin.Context)
func (*Controller) CanManage ¶
func (controller *Controller) CanManage(c *gin.Context)
func (*Controller) CanManageSpecial ¶
func (controller *Controller) CanManageSpecial(c *gin.Context)
func (*Controller) CanModify ¶
func (controller *Controller) CanModify(c *gin.Context)
func (*Controller) ConfigInviteLink ¶
func (controller *Controller) ConfigInviteLink(c *gin.Context)
func (*Controller) CreateUser ¶
func (controller *Controller) CreateUser(c *gin.Context)
func (*Controller) DeleteOldInvite ¶
func (*Controller) DeleteUser ¶
func (controller *Controller) DeleteUser(c *gin.Context)
func (*Controller) DoesTeamInvitePermissionWasClosed ¶
func (controller *Controller) DoesTeamInvitePermissionWasClosed(c *gin.Context, attrg *accesscontrol.AttributeGroup, team *model.Team) bool
func (*Controller) EmailAlreadyUsedByTeamMember ¶
func (controller *Controller) EmailAlreadyUsedByTeamMember(c *gin.Context, email string, teamID int) (bool, *model.TeamMember)
func (*Controller) FeedbackBadRequest ¶
func (controller *Controller) FeedbackBadRequest(c *gin.Context, errorFlag int, errorMessage string)
func (*Controller) FeedbackInternalServerError ¶
func (controller *Controller) FeedbackInternalServerError(c *gin.Context, errorFlag int, errorMessage string)
func (*Controller) FeedbackInviteByEmail ¶
func (controller *Controller) FeedbackInviteByEmail(c *gin.Context, invite *model.Invite)
func (*Controller) FeedbackInviteByLink ¶
func (controller *Controller) FeedbackInviteByLink(c *gin.Context, invite *model.Invite)
func (*Controller) FeedbackNewInviteByEmail ¶
func (controller *Controller) FeedbackNewInviteByEmail(c *gin.Context, invite *model.Invite)
func (*Controller) FeedbackOK ¶
func (controller *Controller) FeedbackOK(c *gin.Context, resp model.Response)
func (*Controller) ForgetPassword ¶
func (controller *Controller) ForgetPassword(c *gin.Context)
func (*Controller) GenerateInviteLink ¶
func (controller *Controller) GenerateInviteLink(c *gin.Context)
Execute Phrase: - init phrase
- get teamID
- get userID
- get userRole
- fetch teamMember record
- check attribute
- fetch team record
- check team permission
- execute invite phrase
- fetch invite record
- if invite already exists
- true, feedback
- generate new invite
- create invite record
- feedback
func (*Controller) GetAllTeamMember ¶
func (controller *Controller) GetAllTeamMember(c *gin.Context)
func (*Controller) GetIntParamFromRequest ¶
func (*Controller) GetMagicIntParamFromRequest ¶
func (*Controller) GetMyTeams ¶
func (controller *Controller) GetMyTeams(c *gin.Context)
func (*Controller) GetStringParamFromHeader ¶
func (*Controller) GetStringParamFromRequest ¶
func (*Controller) GetTargetTeamByIdentifier ¶
func (controller *Controller) GetTargetTeamByIdentifier(c *gin.Context)
func (*Controller) GetTargetUserByInternalRequest ¶
func (controller *Controller) GetTargetUserByInternalRequest(c *gin.Context)
func (*Controller) GetTeamMember ¶
func (controller *Controller) GetTeamMember(c *gin.Context)
func (*Controller) GetTeamPermission ¶
func (controller *Controller) GetTeamPermission(c *gin.Context)
func (*Controller) GetUserAvatarUploadAddress ¶
func (controller *Controller) GetUserAvatarUploadAddress(c *gin.Context)
func (*Controller) GetUserIDFromAuth ¶
func (controller *Controller) GetUserIDFromAuth(c *gin.Context) (int, error)
@note: this param was setted by authenticator.JWTAuth() method
func (*Controller) GetVerificationCode ¶
func (controller *Controller) GetVerificationCode(c *gin.Context)
generate and send verification code email
func (*Controller) InviteMemberByEmail ¶
func (controller *Controller) InviteMemberByEmail(c *gin.Context)
func (*Controller) JoinByLink ¶
func (controller *Controller) JoinByLink(c *gin.Context)
func (*Controller) Logout ¶
func (controller *Controller) Logout(c *gin.Context)
func (*Controller) RemoveTeamMember ¶
func (controller *Controller) RemoveTeamMember(c *gin.Context)
func (*Controller) RenewInviteLink ¶
func (controller *Controller) RenewInviteLink(c *gin.Context)
func (*Controller) RetrieveUserByID ¶
func (controller *Controller) RetrieveUserByID(c *gin.Context)
func (*Controller) SendInvite ¶
func (*Controller) SignUp ¶
func (controller *Controller) SignUp(c *gin.Context)
user sign-up signup -> check if email was used
<> with email invite token -> check invite_token - create user - update team_member - delete invite_token <> with link invite token -> check invite_token - create team_member - create user <> without token -> create user
func (*Controller) Status ¶
func (controller *Controller) Status(c *gin.Context)
func (*Controller) StorageInvite ¶
func (*Controller) StorageTeamMemberByEmailInvite ¶
func (*Controller) TestMagicIntParamFromRequest ¶
func (controller *Controller) TestMagicIntParamFromRequest(c *gin.Context, paramName string) (int, error)
test if Magic int exists in param, if not ,return 0 and an error.
func (*Controller) UpdateAvatar ¶
func (controller *Controller) UpdateAvatar(c *gin.Context)
func (*Controller) UpdateInvite ¶
func (*Controller) UpdateIsTutorialViewed ¶ added in v0.0.7
func (controller *Controller) UpdateIsTutorialViewed(c *gin.Context)
func (*Controller) UpdateLanguage ¶
func (controller *Controller) UpdateLanguage(c *gin.Context)
func (*Controller) UpdateNickname ¶
func (controller *Controller) UpdateNickname(c *gin.Context)
func (*Controller) UpdatePassword ¶
func (controller *Controller) UpdatePassword(c *gin.Context)
func (*Controller) UpdateTeamConfig ¶
func (controller *Controller) UpdateTeamConfig(c *gin.Context)
func (*Controller) UpdateTeamMember ¶
func (controller *Controller) UpdateTeamMember(c *gin.Context, teamMember *model.TeamMember) error
func (*Controller) UpdateTeamMemberRole ¶
func (controller *Controller) UpdateTeamMemberRole(c *gin.Context)
global role config owner <MODIFY> owner -> any. NO, owner must be transferred before modify himself (a team must have an owner).
<MODIFY> admin, editor, viewer -> owner. YES, it's transfer owner action (when the owner transferred, the old owner became an admin). <MODIFY> admin, editor, viewer -> admin, editor, viewer. YES.
admin <MODIFY> owner -> any. NO.
<MODIFY> admin, editor, viewer -> owner. NO. <MODIFY> admin, editor, viewer -> admin, editor, viewer. YES.
editor <MODIFY> any -> any. NO. viewer <MODIFY> any -> any. NO.
func (*Controller) UpdateTeamPermission ¶
func (controller *Controller) UpdateTeamPermission(c *gin.Context)
func (*Controller) ValidateAccount ¶
func (controller *Controller) ValidateAccount(c *gin.Context)