diff --git a/app/models/ability.rb b/app/models/ability.rb index 8f9c9fe4380930fadbb2fbecaf13cba0d956fa75..dccd90c6820e58789085eb949822f5a129daaa8a 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -84,7 +84,11 @@ class Ability can :read, Administration::Qualiopi can :read, Administration::Qualiopi::Criterion can :read, Administration::Qualiopi::Indicator - can :manage, University::Person + can :manage, University::Person, university_id: @user.university_id + can :manage, University::Person::Category, university_id: @user.university_id + can :manage, University::Person::Involvement, university_id: @user.university_id + can :manage, University::Organization, university_id: @user.university_id + can :manage, University::Organization::Category, university_id: @user.university_id can :manage, Communication::Block, university_id: @user.university_id can :create, Communication::Block can :read, Communication::Website, university_id: @user.university_id @@ -118,8 +122,6 @@ class Ability can :manage, Research::Laboratory::Axis, university_id: @user.university_id can :manage, Research::Thesis, university_id: @user.university_id can :manage, University::Role, university_id: @user.university_id - can :manage, University::Person::Involvement, university_id: @user.university_id - can :manage, University::Organization, university_id: @user.university_id can :read, User, university_id: @user.university_id can :manage, User, university_id: @user.university_id, role: @user.managed_roles end diff --git a/app/models/communication/extranet.rb b/app/models/communication/extranet.rb index c99daf122abc88d0f162d495cacdae7a82b36e3b..512e868626c3d62ed8a076f0704b921f1148bd15 100644 --- a/app/models/communication/extranet.rb +++ b/app/models/communication/extranet.rb @@ -2,34 +2,35 @@ # # Table name: communication_extranets # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# color :string -# cookies_policy :text -# css :text -# feature_alumni :boolean default(FALSE) -# feature_contacts :boolean default(FALSE) -# feature_jobs :boolean default(FALSE) -# feature_library :boolean default(FALSE) -# feature_posts :boolean default(FALSE) -# has_sso :boolean default(FALSE) -# home_sentence :text -# host :string -# name :string -# privacy_policy :text -# registration_contact :string -# sass :text -# sso_button_label :string -# sso_cert :text -# sso_mapping :jsonb -# sso_name_identifier_format :string -# sso_provider :integer default("saml") -# sso_target_url :string -# terms :text -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# allow_experiences_modification :boolean default(TRUE) +# color :string +# cookies_policy :text +# css :text +# feature_alumni :boolean default(FALSE) +# feature_contacts :boolean default(FALSE) +# feature_jobs :boolean default(FALSE) +# feature_library :boolean default(FALSE) +# feature_posts :boolean default(FALSE) +# has_sso :boolean default(FALSE) +# home_sentence :text +# host :string +# name :string +# privacy_policy :text +# registration_contact :string +# sass :text +# sso_button_label :string +# sso_cert :text +# sso_mapping :jsonb +# sso_name_identifier_format :string +# sso_provider :integer default("saml") +# sso_target_url :string +# terms :text +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# university_id :uuid not null, indexed # # Indexes # diff --git a/app/models/university/organization/category.rb b/app/models/university/organization/category.rb new file mode 100644 index 0000000000000000000000000000000000000000..cd1d492f675ff381dbdd0fbb047970081129e1ed --- /dev/null +++ b/app/models/university/organization/category.rb @@ -0,0 +1,20 @@ +# == Schema Information +# +# Table name: university_organization_categories +# +# id :uuid not null, primary key +# name :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed +# +# Indexes +# +# index_university_organization_categories_on_university_id (university_id) +# +# Foreign Keys +# +# fk_rails_f610c7eb13 (university_id => universities.id) +# +class University::Organization::Category < ApplicationRecord +end diff --git a/app/models/university/person/category.rb b/app/models/university/person/category.rb new file mode 100644 index 0000000000000000000000000000000000000000..7f56735dcbabc9203d3bbb8583fcfc32cc01e8c7 --- /dev/null +++ b/app/models/university/person/category.rb @@ -0,0 +1,20 @@ +# == Schema Information +# +# Table name: university_person_categories +# +# id :uuid not null, primary key +# name :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed +# +# Indexes +# +# index_university_person_categories_on_university_id (university_id) +# +# Foreign Keys +# +# fk_rails_134ac9c0b6 (university_id => universities.id) +# +class University::Person::Category < ApplicationRecord +end diff --git a/db/migrate/20230313114113_create_university_person_categories.rb b/db/migrate/20230313114113_create_university_person_categories.rb new file mode 100644 index 0000000000000000000000000000000000000000..113bec82fbc743d5941720df4881bb30ca2c3868 --- /dev/null +++ b/db/migrate/20230313114113_create_university_person_categories.rb @@ -0,0 +1,11 @@ +class CreateUniversityPersonCategories < ActiveRecord::Migration[7.0] + def change + create_table :university_person_categories, id: :uuid do |t| + t.string :name + t.references :university, null: false, foreign_key: true, type: :uuid, index: true + + + t.timestamps + end + end +end diff --git a/db/migrate/20230313114528_create_university_organization_categories.rb b/db/migrate/20230313114528_create_university_organization_categories.rb new file mode 100644 index 0000000000000000000000000000000000000000..0d9246a92ff58753852f627fc1212b754666b9cf --- /dev/null +++ b/db/migrate/20230313114528_create_university_organization_categories.rb @@ -0,0 +1,10 @@ +class CreateUniversityOrganizationCategories < ActiveRecord::Migration[7.0] + def change + create_table :university_organization_categories, id: :uuid do |t| + t.string :name + t.references :university, null: false, foreign_key: true, type: :uuid, index: true + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index a47a0f1993c3aa56fdb9e59385075a70a6f64199..8499e55de9668c09781f3dbb8d95c8860d34a65a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_03_10_083029) do +ActiveRecord::Schema[7.0].define(version: 2023_03_13_114528) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -202,6 +202,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_03_10_083029) do t.text "home_sentence" t.text "sass" t.text "css" + t.boolean "allow_experiences_modification", default: true t.index ["about_type", "about_id"], name: "index_communication_extranets_on_about" t.index ["university_id"], name: "index_communication_extranets_on_university_id" end @@ -428,7 +429,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_03_10_083029) do t.index ["university_id"], name: "index_communication_website_pages_on_university_id" end - create_table "communication_website_permalinks", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_permalinks", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "website_id", null: false t.string "about_type", null: false @@ -860,6 +861,14 @@ ActiveRecord::Schema[7.0].define(version: 2023_03_10_083029) do t.index ["default_language_id"], name: "index_universities_on_default_language_id" end + create_table "university_organization_categories", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| + t.string "name" + t.uuid "university_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["university_id"], name: "index_university_organization_categories_on_university_id" + end + create_table "university_organizations", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "name" @@ -932,6 +941,14 @@ ActiveRecord::Schema[7.0].define(version: 2023_03_10_083029) do t.index ["user_id"], name: "index_university_people_on_user_id" end + create_table "university_person_categories", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| + t.string "name" + t.uuid "university_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["university_id"], name: "index_university_person_categories_on_university_id" + end + create_table "university_person_experiences", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "person_id", null: false @@ -1116,11 +1133,13 @@ ActiveRecord::Schema[7.0].define(version: 2023_03_10_083029) do add_foreign_key "research_theses", "university_people", column: "author_id" add_foreign_key "research_theses", "university_people", column: "director_id" add_foreign_key "universities", "languages", column: "default_language_id" + add_foreign_key "university_organization_categories", "universities" add_foreign_key "university_organizations", "universities" add_foreign_key "university_people", "languages" add_foreign_key "university_people", "universities" add_foreign_key "university_people", "university_people", column: "original_id" add_foreign_key "university_people", "users" + add_foreign_key "university_person_categories", "universities" add_foreign_key "university_person_experiences", "universities" add_foreign_key "university_person_experiences", "university_organizations", column: "organization_id" add_foreign_key "university_person_experiences", "university_people", column: "person_id" diff --git a/test/fixtures/communication/extranets.yml b/test/fixtures/communication/extranets.yml index c4a72564511a4905256b44eff1b90d9ad95d76db..5b00f559b78ac19b9a3871e2736923e92e325c4b 100644 --- a/test/fixtures/communication/extranets.yml +++ b/test/fixtures/communication/extranets.yml @@ -2,34 +2,35 @@ # # Table name: communication_extranets # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# color :string -# cookies_policy :text -# css :text -# feature_alumni :boolean default(FALSE) -# feature_contacts :boolean default(FALSE) -# feature_jobs :boolean default(FALSE) -# feature_library :boolean default(FALSE) -# feature_posts :boolean default(FALSE) -# has_sso :boolean default(FALSE) -# home_sentence :text -# host :string -# name :string -# privacy_policy :text -# registration_contact :string -# sass :text -# sso_button_label :string -# sso_cert :text -# sso_mapping :jsonb -# sso_name_identifier_format :string -# sso_provider :integer default("saml") -# sso_target_url :string -# terms :text -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# allow_experiences_modification :boolean default(TRUE) +# color :string +# cookies_policy :text +# css :text +# feature_alumni :boolean default(FALSE) +# feature_contacts :boolean default(FALSE) +# feature_jobs :boolean default(FALSE) +# feature_library :boolean default(FALSE) +# feature_posts :boolean default(FALSE) +# has_sso :boolean default(FALSE) +# home_sentence :text +# host :string +# name :string +# privacy_policy :text +# registration_contact :string +# sass :text +# sso_button_label :string +# sso_cert :text +# sso_mapping :jsonb +# sso_name_identifier_format :string +# sso_provider :integer default("saml") +# sso_target_url :string +# terms :text +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# university_id :uuid not null, indexed # # Indexes # diff --git a/test/fixtures/university/organization/categories.yml b/test/fixtures/university/organization/categories.yml new file mode 100644 index 0000000000000000000000000000000000000000..4dcdac2a705b77ff024c47890c2a890e7d432435 --- /dev/null +++ b/test/fixtures/university/organization/categories.yml @@ -0,0 +1,25 @@ +# == Schema Information +# +# Table name: university_organization_categories +# +# id :uuid not null, primary key +# name :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed +# +# Indexes +# +# index_university_organization_categories_on_university_id (university_id) +# +# Foreign Keys +# +# fk_rails_f610c7eb13 (university_id => universities.id) +# +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyString + +two: + name: MyString diff --git a/test/fixtures/university/person/categories.yml b/test/fixtures/university/person/categories.yml new file mode 100644 index 0000000000000000000000000000000000000000..a368f971ae61e59f3428aa276bf443ba24f20755 --- /dev/null +++ b/test/fixtures/university/person/categories.yml @@ -0,0 +1,24 @@ +# == Schema Information +# +# Table name: university_person_categories +# +# id :uuid not null, primary key +# name :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed +# +# Indexes +# +# index_university_person_categories_on_university_id (university_id) +# +# Foreign Keys +# +# fk_rails_134ac9c0b6 (university_id => universities.id) +# + +one: + name: MyString + +two: + name: MyString diff --git a/test/models/communication/extranet_test.rb b/test/models/communication/extranet_test.rb index 72be11939515c0927e5c3266698692eae000ee5a..0fbfb1c43e253bdc46da936417e5b507126faf56 100644 --- a/test/models/communication/extranet_test.rb +++ b/test/models/communication/extranet_test.rb @@ -2,34 +2,35 @@ # # Table name: communication_extranets # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# color :string -# cookies_policy :text -# css :text -# feature_alumni :boolean default(FALSE) -# feature_contacts :boolean default(FALSE) -# feature_jobs :boolean default(FALSE) -# feature_library :boolean default(FALSE) -# feature_posts :boolean default(FALSE) -# has_sso :boolean default(FALSE) -# home_sentence :text -# host :string -# name :string -# privacy_policy :text -# registration_contact :string -# sass :text -# sso_button_label :string -# sso_cert :text -# sso_mapping :jsonb -# sso_name_identifier_format :string -# sso_provider :integer default("saml") -# sso_target_url :string -# terms :text -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# allow_experiences_modification :boolean default(TRUE) +# color :string +# cookies_policy :text +# css :text +# feature_alumni :boolean default(FALSE) +# feature_contacts :boolean default(FALSE) +# feature_jobs :boolean default(FALSE) +# feature_library :boolean default(FALSE) +# feature_posts :boolean default(FALSE) +# has_sso :boolean default(FALSE) +# home_sentence :text +# host :string +# name :string +# privacy_policy :text +# registration_contact :string +# sass :text +# sso_button_label :string +# sso_cert :text +# sso_mapping :jsonb +# sso_name_identifier_format :string +# sso_provider :integer default("saml") +# sso_target_url :string +# terms :text +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# university_id :uuid not null, indexed # # Indexes # diff --git a/test/models/university/organization/category_test.rb b/test/models/university/organization/category_test.rb new file mode 100644 index 0000000000000000000000000000000000000000..0295b5bda964ad02f6f1752596d8ee023c69dff9 --- /dev/null +++ b/test/models/university/organization/category_test.rb @@ -0,0 +1,25 @@ +# == Schema Information +# +# Table name: university_organization_categories +# +# id :uuid not null, primary key +# name :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed +# +# Indexes +# +# index_university_organization_categories_on_university_id (university_id) +# +# Foreign Keys +# +# fk_rails_f610c7eb13 (university_id => universities.id) +# +require "test_helper" + +class University::Organization::CategoryTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/university/person/category_test.rb b/test/models/university/person/category_test.rb new file mode 100644 index 0000000000000000000000000000000000000000..bc83c9ff9c76eab8ead988e7f1e08a93dab5be1a --- /dev/null +++ b/test/models/university/person/category_test.rb @@ -0,0 +1,25 @@ +# == Schema Information +# +# Table name: university_person_categories +# +# id :uuid not null, primary key +# name :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed +# +# Indexes +# +# index_university_person_categories_on_university_id (university_id) +# +# Foreign Keys +# +# fk_rails_134ac9c0b6 (university_id => universities.id) +# +require "test_helper" + +class University::Person::CategoryTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end