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

[MM-58805]: Remove Standalone code part - 1 #2

Merged
merged 27 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6191901
refactor: isPlugin for API level
Rajat-Dabade Jun 27, 2024
fae82fe
chore: removed GetContextConn as it is not required
Rajat-Dabade Jun 27, 2024
a20079b
chore: clean up api.go removed none required function
Rajat-Dabade Jun 27, 2024
60c76e9
chore: removed commented code
Rajat-Dabade Jun 27, 2024
4c9a8a9
refactor: removed the admin as its no log required
Rajat-Dabade Jun 27, 2024
f942a47
refactor: removed handlePostTeamRegenerateSignupToken as not used any…
Rajat-Dabade Jun 27, 2024
688f53a
refactor: updated make file rules
Rajat-Dabade Jun 28, 2024
80d402e
refactor: removed isGuest code
Rajat-Dabade Jun 28, 2024
403ba9c
refactor: removed auth login password changepassword code
Rajat-Dabade Jun 28, 2024
f2b54b8
chore: linter fixes
Rajat-Dabade Jun 28, 2024
70467de
refactor: removed user login register code
Rajat-Dabade Jun 30, 2024
ef9438a
chore: linter fixes
Rajat-Dabade Jul 1, 2024
2a1a362
refactor: removed auth layer
Rajat-Dabade Jul 1, 2024
e718d7e
refactor: removed isSingle user checks
Rajat-Dabade Jul 1, 2024
084839a
chore: removed debugging logs
Rajat-Dabade Jul 1, 2024
3b46c4b
chore: removed debugging logs
Rajat-Dabade Jul 1, 2024
64af4d5
revert: isGuestUser check
Rajat-Dabade Jul 5, 2024
4735490
Deprecate standalone SQL store level (#4)
Rajat-Dabade Jul 13, 2024
fdeee37
MM-59356: Fixing testcase for webapp and server (#6)
Rajat-Dabade Jul 16, 2024
8de7da4
[MM-59349]: Getting Rid of Mattermost Auth layer (#10)
Rajat-Dabade Jul 23, 2024
a407440
[MM-59824]: Removed website code. (#12)
Rajat-Dabade Jul 23, 2024
4b4b0b2
MM-59294: Workflow updated and release process (#7)
Rajat-Dabade Jul 25, 2024
611c2a2
From `focalboard` to `board` to generate tar bundle (#14)
Rajat-Dabade Jul 27, 2024
3224d6a
fix: ci issue
Rajat-Dabade Jul 30, 2024
6023e19
chore: ci fix
Rajat-Dabade Jul 30, 2024
8b46385
chore: ci fix
Rajat-Dabade Jul 30, 2024
5d0f1ce
minor fix
Rajat-Dabade Jul 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ endif

@echo plugin built at: dist/$(BUNDLE_NAME)

info: ## Display build information
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was only added for debugging purposes. Will remove this after the plugin becomes stable.
Created the issue to track this down: #3

@echo "Build Number: $(BUILD_NUMBER)"
@echo "Build Date: $(BUILD_DATE)"
@echo "Build Hash: $(BUILD_HASH)"
@echo "Plugin ID: $(PLUGIN_ID)"
@echo "Plugin Version: $(PLUGIN_VERSION)"
@echo "Bundle Name: $(BUNDLE_NAME)"

## Builds and bundles the plugin.
.PHONY: dist
dist: apply server webapp bundle
Expand Down Expand Up @@ -382,7 +390,7 @@ watch-plugin: modd-precheck ## Run and upload the plugin to a development server
env FOCALBOARD_BUILD_TAGS='$(BUILD_TAGS)' modd -f modd-watchplugin.conf

live-watch-plugin: modd-precheck ## Run and update locally the plugin in the development server
cd mattermost-plugin; make live-watch
make live-watch

swagger: ## Generate swagger API spec and clients based on it.
mkdir -p server/swagger/docs
Expand Down
8 changes: 0 additions & 8 deletions server/admin-scripts/reset-password.sh

This file was deleted.

56 changes: 0 additions & 56 deletions server/api/admin.go

This file was deleted.

39 changes: 11 additions & 28 deletions server/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,12 @@ var (
// REST APIs

type API struct {
app *app.App
authService string
permissions permissions.PermissionsService
singleUserToken string
MattermostAuth bool
logger mlog.LoggerIFace
audit *audit.Audit
isPlugin bool
app *app.App
authService string
permissions permissions.PermissionsService
MattermostAuth bool
logger mlog.LoggerIFace
audit *audit.Audit
}

func NewAPI(
Expand All @@ -51,16 +49,13 @@ func NewAPI(
permissions permissions.PermissionsService,
logger mlog.LoggerIFace,
audit *audit.Audit,
isPlugin bool,
) *API {
return &API{
app: app,
singleUserToken: singleUserToken,
authService: authService,
permissions: permissions,
logger: logger,
audit: audit,
isPlugin: isPlugin,
app: app,
authService: authService,
permissions: permissions,
logger: logger,
audit: audit,
}
}

Expand All @@ -77,7 +72,6 @@ func (a *API) RegisterRoutes(r *mux.Router) {

// V2 routes (ToDo: migrate these to V3 when ready to ship V3)
a.registerUsersRoutes(apiv2)
a.registerAuthRoutes(apiv2)
a.registerMembersRoutes(apiv2)
a.registerCategoriesRoutes(apiv2)
a.registerSharingRoutes(apiv2)
Expand All @@ -104,10 +98,6 @@ func (a *API) RegisterRoutes(r *mux.Router) {
a.registerSystemRoutes(r)
}

func (a *API) RegisterAdminRoutes(r *mux.Router) {
r.HandleFunc("/api/v2/admin/users/{username}/password", a.adminRequired(a.handleAdminSetPassword)).Methods("POST")
}

func getUserID(r *http.Request) string {
ctx := r.Context()
session, ok := ctx.Value(sessionContextKey).(*model.Session)
Expand Down Expand Up @@ -168,13 +158,6 @@ func (a *API) hasValidReadTokenForBoard(r *http.Request, boardID string) bool {
return isValid
}

func (a *API) userIsGuest(userID string) (bool, error) {
if a.singleUserToken != "" {
return false, nil
}
return a.app.UserIsGuest(userID)
}

// Response helpers

func (a *API) errorResponse(w http.ResponseWriter, r *http.Request, err error) {
Expand Down
18 changes: 1 addition & 17 deletions server/api/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,6 @@ func (a *API) handleArchiveImport(w http.ResponseWriter, r *http.Request) {
return
}

isGuest, err := a.userIsGuest(userID)
Rajat-Dabade marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
a.errorResponse(w, r, err)
return
}
if isGuest {
a.errorResponse(w, r, model.NewErrPermission("access denied to create board"))
return
}

file, handle, err := r.FormFile(UploadFormFileKey)
if err != nil {
fmt.Fprintf(w, "%v", err)
Expand Down Expand Up @@ -220,13 +210,7 @@ func (a *API) handleArchiveExportTeam(w http.ResponseWriter, r *http.Request) {
defer a.audit.LogRecord(audit.LevelRead, auditRec)
auditRec.AddMeta("TeamID", teamID)

isGuest, err := a.userIsGuest(userID)
Rajat-Dabade marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
a.errorResponse(w, r, err)
return
}

boards, err := a.app.GetBoardsForUserAndTeam(userID, teamID, !isGuest)
boards, err := a.app.GetBoardsForUserAndTeam(userID, teamID, false)
if err != nil {
a.errorResponse(w, r, err)
return
Expand Down
Loading
Loading