feat: add default privileges for new user

This commit is contained in:
skeris 2023-11-13 02:39:05 +03:00
parent 39aa4162e2
commit c1e17fe655
3 changed files with 11 additions and 1 deletions

BIN
app

Binary file not shown.

@ -111,6 +111,16 @@ func (h *Handlers) AmoSaveToken(w http.ResponseWriter, r *http.Request) {
Subdomain: accountAmo.Subdomain,
ExpiresIn: token.Expiry,
TokenType: token.TokenType,
Privileges: map[string]model.ShortPrivilige{
model.PrivilegeTemplateCount: model.ShortPrivilige{
Amount: model.BasicAmountPrivilegeTemplateCount,
CreatedAt: time.Now(),
},
model.PrivilegeTemplateStorage: model.ShortPrivilige{
Amount: model.BasicAmountPrivilegeTemplateStorage,
CreatedAt: time.Now(),
},
},
})
if err != nil {
h.reportError(w, http.StatusInternalServerError, err)

@ -12,7 +12,7 @@ func TestPrivileges(t *testing.T) {
ctx := context.Background()
bdd.Scenario(t, "setPrivilegesLogic", func(t *testing.T, runID string) {
t.Helper()
/* bdd.Test(t, "getOldPrivileges", func() {
/* bdd.Test(t, "getOldPrivileges", func() {
p, err := GetActualPrivileges(ctx, "https://admin.pena.digital/strator")
assert.NoError(t, err)
assert.NotEqual(t, len(p), 0)