Skip to content

Commit

Permalink
Remove check for attendance access for other users
Browse files Browse the repository at this point in the history
The field returned by the employee query didn't have the desired effect.
So we'll just try to fetch them anyway.
It's a step backwards in UX but I couldn't quickly figure how to check permissions.
  • Loading branch information
ccremer committed Nov 10, 2021
1 parent d4788f4 commit 98b8936
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
4 changes: 1 addition & 3 deletions pkg/odoo/employee.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
type Employee struct {
ID int `json:"id"`
Name string `json:"name"`
// AttendanceAccess returns true if the requesting user id has access to read attendances of this employee.
AttendanceAccess bool `json:"attendance_access"`
}

// SearchEmployee searches for an Employee with the given searchString in the Employee.Name.
Expand Down Expand Up @@ -53,7 +51,7 @@ func (c *Client) FetchEmployee(sid string, userId int) (*Employee, error) {
body, err := NewJsonRpcRequest(&ReadModelRequest{
Model: "hr.employee",
Domain: []Filter{[]interface{}{"user_id", "=", userId}},
Fields: []string{"name", "attendance_access"},
Fields: []string{"name"},
Limit: 0,
Offset: 0,
}).Encode()
Expand Down
4 changes: 0 additions & 4 deletions pkg/web/attendance_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ func (s Server) OvertimeReport() http.Handler {
view.ShowError(w, fmt.Errorf("no user matching '%s' found", searchUser))
return
}
if !e.AttendanceAccess {
view.ShowError(w, fmt.Errorf("you don't have access to read attendances of '%s'", e.Name))
return
}
employee = e
} else {
e, err := s.odoo.FetchEmployee(session.ID, session.UID)
Expand Down

0 comments on commit 98b8936

Please sign in to comment.