Skip to content

added user attribute for loan officer#30

Merged
amanfoundongithub merged 1 commit into
mainfrom
f-add-Loan-officer
Jun 11, 2026
Merged

added user attribute for loan officer#30
amanfoundongithub merged 1 commit into
mainfrom
f-add-Loan-officer

Conversation

@amanfoundongithub

@amanfoundongithub amanfoundongithub commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Summary by Sourcery

Extend loan officer user attributes with additional document access permissions.

New Features:

  • Introduce distinct document download and view permission keys for user attributes.

Enhancements:

  • Grant loan officer users download and view permissions alongside existing upload permission in registration attributes.

@sourcery-ai

sourcery-ai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Extends loan officer user attributes to include new document download and view permissions, and ensures these permissions are set when building registration attributes for loan officers.

Flow diagram for loan officer registration attributes with new permissions

flowchart TD
    A[buildRegistrationAttributes]
    A --> B{registrationData.userRole == KEY_USER_ROLE_LOAN_OFFICER}
    B -->|yes| C[getAttributesForLoanOfficer]
    B -->|no| D[Return base attributes]

    C --> E["attributes.put(DOCUMENT_UPLOAD_PERMISSION, true)"]
    C --> F["attributes.put(DOCUMENT_DOWNLOAD_PERMISSION, true)"]
    C --> G["attributes.put(DOCUMENT_FETCH_PERMISSION, true)"]
    E --> H[Return attributes]
    F --> H
    G --> H
Loading

File-Level Changes

Change Details Files
Add download and view document permissions for loan officers and set them during attribute construction.
  • Introduce constants for document download and view permissions alongside existing upload permission.
  • Update the loan officer attribute builder to grant document download permission.
  • Update the loan officer attribute builder to grant document view/fetch permission.
src/main/java/com/loan_org/identity_and_access_management/util/UserAttributeFactory.java

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@amanfoundongithub amanfoundongithub merged commit f7ca4f0 into main Jun 11, 2026
4 checks passed

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The DOCUMENT_FETCH_PERMISSION constant is mapped to the "document:view" value, which is slightly inconsistent with its name; consider renaming either the constant or the value so the terminology is aligned (e.g., DOCUMENT_VIEW_PERMISSION or "document:fetch").
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `DOCUMENT_FETCH_PERMISSION` constant is mapped to the `"document:view"` value, which is slightly inconsistent with its name; consider renaming either the constant or the value so the terminology is aligned (e.g., `DOCUMENT_VIEW_PERMISSION` or `"document:fetch"`).

## Individual Comments

### Comment 1
<location path="src/main/java/com/loan_org/identity_and_access_management/util/UserAttributeFactory.java" line_range="18" />
<code_context>

     public static final String DOCUMENT_UPLOAD_PERMISSION = "document:upload";
+    public static final String DOCUMENT_DOWNLOAD_PERMISSION = "document:download";
+    public static final String DOCUMENT_FETCH_PERMISSION = "document:view";

     public Map<String, Object> buildRegistrationAttributes(UserRegistrationDto registrationData) {
</code_context>
<issue_to_address>
**suggestion:** Clarify the semantic difference between `download` and `view` permissions to avoid future misuse.

Since `DOCUMENT_FETCH_PERMISSION` maps to `"document:view"`, the name may imply a more generic operation than intended. If `view` and `download` are distinct capabilities, consider renaming the constant to match the permission string (e.g., `DOCUMENT_VIEW_PERMISSION`) or adjusting the permission string to match the name, to keep permission checks unambiguous across the codebase.

Suggested implementation:

```java
    public static final String DOCUMENT_UPLOAD_PERMISSION = "document:upload";
    public static final String DOCUMENT_DOWNLOAD_PERMISSION = "document:download";
    public static final String DOCUMENT_VIEW_PERMISSION = "document:view";

```

```java
    private void getAttributesForLoanOfficer(Map<String, Object> attributes) {
        attributes.put(DOCUMENT_UPLOAD_PERMISSION, true);
        attributes.put(DOCUMENT_DOWNLOAD_PERMISSION, true);
        attributes.put(DOCUMENT_VIEW_PERMISSION, true);
    }

```

1. Search the entire codebase for usages of `DOCUMENT_FETCH_PERMISSION` and update them to `DOCUMENT_VIEW_PERMISSION`.
2. If any configuration, documentation, or tests reference `DOCUMENT_FETCH_PERMISSION`, update them as well to keep naming consistent and avoid confusion between `view` and `download` capabilities.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.


public static final String DOCUMENT_UPLOAD_PERMISSION = "document:upload";
public static final String DOCUMENT_DOWNLOAD_PERMISSION = "document:download";
public static final String DOCUMENT_FETCH_PERMISSION = "document:view";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Clarify the semantic difference between download and view permissions to avoid future misuse.

Since DOCUMENT_FETCH_PERMISSION maps to "document:view", the name may imply a more generic operation than intended. If view and download are distinct capabilities, consider renaming the constant to match the permission string (e.g., DOCUMENT_VIEW_PERMISSION) or adjusting the permission string to match the name, to keep permission checks unambiguous across the codebase.

Suggested implementation:

    public static final String DOCUMENT_UPLOAD_PERMISSION = "document:upload";
    public static final String DOCUMENT_DOWNLOAD_PERMISSION = "document:download";
    public static final String DOCUMENT_VIEW_PERMISSION = "document:view";
    private void getAttributesForLoanOfficer(Map<String, Object> attributes) {
        attributes.put(DOCUMENT_UPLOAD_PERMISSION, true);
        attributes.put(DOCUMENT_DOWNLOAD_PERMISSION, true);
        attributes.put(DOCUMENT_VIEW_PERMISSION, true);
    }
  1. Search the entire codebase for usages of DOCUMENT_FETCH_PERMISSION and update them to DOCUMENT_VIEW_PERMISSION.
  2. If any configuration, documentation, or tests reference DOCUMENT_FETCH_PERMISSION, update them as well to keep naming consistent and avoid confusion between view and download capabilities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant