Merge pull request #84 from finnlabs/feature/permission_adjustments_21193
aligned permissions with defaultdata.openproject.compull/6827/head
commit
070b387c06
@ -0,0 +1 @@ |
||||
OpenProject::Meeting::DefaultData.load! unless Rails.env.test? |
@ -0,0 +1,42 @@ |
||||
module OpenProject |
||||
module Meeting |
||||
module DefaultData |
||||
module_function |
||||
|
||||
def load! |
||||
add_permissions! member_role, member_permissions || raise('Member role not found') |
||||
add_permissions! reader_role, reader_permissions || raise('Reader role not found') |
||||
end |
||||
|
||||
def add_permissions!(role, permissions) |
||||
role.add_permission! *permissions |
||||
end |
||||
|
||||
def member_role |
||||
Role.find_by name: I18n.t(:default_role_member) |
||||
end |
||||
|
||||
def member_permissions |
||||
[ |
||||
:create_meetings, |
||||
:edit_meetings, |
||||
:delete_meetings, |
||||
:view_meetings, |
||||
:create_meeting_agendas, |
||||
:close_meeting_agendas, |
||||
:send_meeting_agendas_notification, |
||||
:create_meeting_minutes, |
||||
:send_meeting_minutes_notification |
||||
] |
||||
end |
||||
|
||||
def reader_role |
||||
Role.find_by name: I18n.t(:default_role_reader) |
||||
end |
||||
|
||||
def reader_permissions |
||||
[:view_meetings] |
||||
end |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue