Skip to content

Commit 023cd16

Browse files
committed
fix(pro): disable pro flag for current user if no subscription activated
1 parent cdf97c4 commit 023cd16

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

api/user.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ package api
33
import (
44
"crypto/rand"
55
"encoding/base64"
6+
"io"
7+
"net/http"
8+
"strings"
9+
610
"github.com/gorilla/mux"
711
"github.com/semaphoreui/semaphore/api/helpers"
812
"github.com/semaphoreui/semaphore/db"
913
"github.com/semaphoreui/semaphore/pro_interfaces"
1014
"github.com/semaphoreui/semaphore/util"
11-
"io"
12-
"net/http"
13-
"strings"
1415
)
1516

1617
type UserController struct {
@@ -38,7 +39,9 @@ func (c *UserController) GetUser(w http.ResponseWriter, r *http.Request) {
3839
user.User = *helpers.GetFromContext(r, "user").(*db.User)
3940
user.CanCreateProject = user.Admin || util.Config.NonAdminCanCreateProject
4041
user.HasActiveSubscription = c.subscriptionService.HasActiveSubscription()
41-
42+
if !user.HasActiveSubscription {
43+
user.Pro = false
44+
}
4245
helpers.WriteJSON(w, http.StatusOK, user)
4346
}
4447

0 commit comments

Comments
 (0)