Skip to content

Conversation

ManuelMoeri
Copy link
Collaborator

No description provided.

@ManuelMoeri ManuelMoeri self-assigned this Jul 28, 2025
@ManuelMoeri ManuelMoeri linked an issue Jul 28, 2025 that may be closed by this pull request
3 tasks
@ManuelMoeri ManuelMoeri changed the base branch from feature/946-setup-cancancan to master July 29, 2025 07:08
@ManuelMoeri ManuelMoeri changed the base branch from master to feature/946-setup-cancancan July 29, 2025 07:09
@ManuelMoeri ManuelMoeri force-pushed the feature/946-setup-cancancan branch from 0532487 to 83da19f Compare July 29, 2025 11:33
@ManuelMoeri ManuelMoeri force-pushed the feature/947-every-person-can-edit-themselves branch from 6edce74 to ba30b19 Compare July 29, 2025 12:16
PersonRoleLevel.find_by(level: role[:role_level])&.id || PersonRoleLevel.first.id
end

def update_person_with_auth_user_id
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe rename this to something like set_auth_user_id_on_person?


def update_person_with_auth_user_id
ldap_username = @ptime_employee_attributes[:ldapname]
@person.auth_user_id = AuthUser.find_by(ldap_username:)&.id
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably use find_by! here so the transaction fails if the AuthUser is not found.

@@ -0,0 +1,5 @@
class AddAuthUserIdToPeople < ActiveRecord::Migration[8.0]
Copy link
Collaborator

Choose a reason for hiding this comment

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

You could combine both migrations to one

@@ -0,0 +1,5 @@
class AddAuthUserIdToPeople < ActiveRecord::Migration[8.0]
def change
add_column :people, :auth_user_id, :integer, foreign_key: { to_table: :people }
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should probably also add belongs_to and has_one to people and auth_users respectively.
See: https://guides.rubyonrails.org/association_basics.html


click_link('Bearbeiten', href: edit_person_path(ursula))
fill_in 'person_title', with: 'Expert at access control'
save_button = find_button("Person aktualisieren")
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is a click_button method

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.

Access control: Every person can edit themselves
2 participants