mirror of
https://github.com/harness/drone.git
synced 2025-05-13 23:50:47 +08:00
[Protection Rules] Load user from store in pre-receive hook (#747)
This commit is contained in:
parent
b7e68971b0
commit
3418dd1127
@ -67,9 +67,14 @@ func (c *Controller) PreReceive(
|
|||||||
return output, nil
|
return output, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove the dummy session and use the real session, once that has been done and the session has a value.
|
// TODO: use store.PrincipalInfoCache once we abstracted principals.
|
||||||
|
principal, err := c.principalStore.Find(ctx, principalID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to find inner principal with id %d: %w", principalID, err)
|
||||||
|
}
|
||||||
|
|
||||||
dummySession := &auth.Session{
|
dummySession := &auth.Session{
|
||||||
Principal: types.Principal{ID: principalID, Admin: false}, // TODO: In the dummySession "Admin" is always false
|
Principal: *principal,
|
||||||
Metadata: nil,
|
Metadata: nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user