Skip to content

Feat/add organization management#471

Open
amriith wants to merge 2 commits intodoubtfire-lms:9.xfrom
amriith:feat/add-organization-management
Open

Feat/add organization management#471
amriith wants to merge 2 commits intodoubtfire-lms:9.xfrom
amriith:feat/add-organization-management

Conversation

@amriith
Copy link

@amriith amriith commented Jul 14, 2025

This change implements a comprehensive organization management system for Ontrack. The feature allows administrators to create and manage organizations, and users can be members of multiple organizations. Users can also set their current active organization, which enables organization-specific views and functionality.

Organization CRUD operations (create, read, update, delete)
User membership management (add/remove members)
Organization switching functionality
User search for adding members
Authorization controls for organization management

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration


#Run these Migration commands in your terminal 
rails generate migration CreateOrganizations name:string description:text


rails generate migration CreateUserOrganizations user:references organization:references



rails generate migration AddCurrentOrganizationToUsers current_organization:references

After creating the migration, you can run it with:
rails db:migrate

Test A
Rails console testing for model relationships

From the bash terminal run- rails console
 # Create an organization

org = Organization.create(name: "Test Organization", description: "Testing")
 # Find an admin user
 admin = User.find_by(role_id: Role.admin_id)

# Add user to organization

 org.users << admin

# Check if user is in organization

org.users.include?(admin) # Should return true

# Test organization switching (if you've added current_organization_id to User)

admin.update(current_organization_id: org.id)

Test B

Can Alternatively test from the backend Using Postman

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation if appropriate
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have created or extended unit tests to address my new additions
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

If you have any questions, please contact @macite or @jakerenzella.

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