A common scenario in time cockpit is assigning different permissions to team leaders and team members. Team leaders should see all time sheet records of all members whereas team members should only see their own records. In this blog post you learn how you can set up this logic in time cockpit within a few minutes.
Requirement
This is the scenario that I want to implement in this blog post:
- Time cockpit supports assigning users to departments out of the box. We want to add the possibility to assign 0...n team leaders for each department.
- Every user can only see and edit her own time sheet records.
- In addition to (2), team leaders can see (not edit) time sheet records of all members in their team (=department).
Note that we reuse the existing department table in this blog post. You could create a separate team table if you want.
Video Step-by-Step Tutorial
Checklist
- Create a new entity (=table) to store team leader assignments. It has a relation to APP_Department and APP_UserDetail.
Don't forget to limit access permissions to the new table as shown in the video above. Otherwise everbody could remove you time sheet permissions by changing team leader assignments.
-
Optionally create a custom UI (list, form) for departments so you can edit department members and team leaders directly in the department form.
- Create a new form for APP_Department.
- Create a new list for APP_Department.
- Set the new form and list as the new UI for the APP_Department entity.
- Create a set containing all departments that the current user is leader of. Here is the TCQL statement that is shown in the video above:
From D In TeamLeader
Where D.TeamLeaderUser.UserDetailUuid = Environment.CurrentUser.UserDetailUuid
Select New With { D.Department.Code }
- Define the read/write permissions in the APP_Timesheet entity. Here is the TCQL expression that is shown in the video for the write permission:
Current.UserDetail.UserDetailUuid = Environment.CurrentUser.UserDetailUuid
Or Current.UserDetail.Department.Code In Set('DepartmentsLedByMe', 'Code')
Or 'Admin' In Set('CurrentUserRoles', 'Code')
Questions
In case of questions contact us at support@timecockpit.com.
comments powered by