Employee self-service: own full profile + Education/Work Experience - #15
Open
hamad-clustox wants to merge 1 commit into
Open
hamad-clustox wants to merge 1 commit into
hamad-clustox wants to merge 1 commit into
Conversation
…ience Let each employee view their OWN full profile in the /hrms PWA (personal details, CNIC, bank) without exposing any colleague's confidential fields, and surface Education and Work Experience — which the stock mobile profile did not show at all. Backend (setup/permissions/apply_self_service.py): - Record-scope the Employee doctype to the employee's own record for pure self-service logins (User Permission allow=Employee, applicable_for=Employee). - Grant the "Employee Self Service" role read on permlevel 1 (personal) and 2 (bank). Because the record is scoped, this can only ever reveal the employee's own data — a colleague's record is unreachable even via the API. - Idempotent; skips users holding a broad role. Re-run after new logins. hrms/api/get_all_employees: run with ignore_permissions so the company directory / org chart still lists everyone (only 9 non-confidential fields are returned) despite the record scope above. Frontend: new ProfileChildTableModal renders read-only child-table sections; Profile.vue adds Education (education) and Work Experience (external_work_history), with labels pulled from the child doctype meta. Verified as a scoped test employee: own confidential fields visible, has_permission read of a colleague = False, permissioned Employee list = 1, directory still lists all, no admin capabilities. Note: run `bench execute hrms.apply_self_service.run` after deploy, and re-run whenever new employee logins are created (not yet automatic). Profile is read-only; editing should be added later as an approval-based change request so employees cannot alter their own designation/salary. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
The HR manager asked to let each employee see their own full profile (personal details, education, everything) and a scoped dashboard, via the
/hrmsself-service PWA. Two gaps blocked this:This PR closes both while keeping colleagues' confidential data unreachable.
Changes
setup/permissions/apply_self_service.py(new)Employeedoctype to the employee's own record for pure self-service logins (User Permissionallow=Employee, applicable_for=Employee).hrms/api/get_all_employees— runs withignore_permissionsso the company directory / org chart still lists everyone (only 9 non-confidential fields are returned) despite the record scope.Frontend — new
ProfileChildTableModal.vuerenders read-only child-table sections;Profile.vueadds Education (education) and Work Experience (external_work_history), with labels pulled from the child doctype meta (robust to custom fields).Verification (as a scoped test employee)
has_permission("Employee","read", colleague)→ False ✅get_list("Employee")→ 1 (own only) ✅get_all_employees()→ all 121 (safe fields) ✅create Leave Type/ write others' salary → False ✅Deploy / ops notes
bench --site <site> execute hrms.apply_self_service.run, and re-run whenever new employee logins are created (not yet automatic — same gap asscope_employees.py).yarn buildinfrontend/and shipping the built assets.🤖 Generated with Claude Code