Skip to content

Commit

Permalink
Merge 2cbba97 into e4c3892
Browse files Browse the repository at this point in the history
  • Loading branch information
dencoded committed Dec 19, 2018
2 parents e4c3892 + 2cbba97 commit e771951
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func (t BaseMiddleware) ApplyPolicies(key string, session *user.SessionState) er
}

// check if we already have limit on API level specified when policy was created
if accessRights.Limit == nil {
if accessRights.Limit == nil || *accessRights.Limit == (user.APILimit{}) {
// limit was not specified on API level so we will populate it from policy
accessRights.Limit = &user.APILimit{
QuotaMax: policy.QuotaMax,
Expand All @@ -292,9 +292,6 @@ func (t BaseMiddleware) ApplyPolicies(key string, session *user.SessionState) er
}
}

// adjust policy access right with limit on API level
policy.AccessRights[apiID] = accessRights

// overwrite session access right for this API
rights[apiID] = accessRights

Expand Down

0 comments on commit e771951

Please sign in to comment.