Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
public enum ProgramSecuredRole {
MEMBER("member"),
BREEDER("breeder"),
SYSTEM_ADMIN("admin");
SYSTEM_ADMIN("admin"),
EXPERIMENTAL_COLLABORATOR("Experimental Collaborator");

private String domain;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.breedinginsight.daos;

import lombok.extern.slf4j.Slf4j;
import org.breedinginsight.dao.db.tables.daos.ExperimentProgramUserRoleDao;
import org.jooq.Configuration;
import org.jooq.DSLContext;

import javax.inject.Inject;
import javax.inject.Singleton;

@Slf4j
@Singleton
public class ExperimentalCollaboratorDAO extends ExperimentProgramUserRoleDao {

private DSLContext dsl;

@Inject
public ExperimentalCollaboratorDAO(Configuration config, DSLContext dsl) {
super(config);
this.dsl = dsl;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.breedinginsight.services;

import lombok.extern.slf4j.Slf4j;
import org.breedinginsight.daos.ExperimentalCollaboratorDAO;

import javax.inject.Inject;

@Slf4j
public class ExperimentalCollaboratorService {

private final ExperimentalCollaboratorDAO experimentalCollaboratorDAO;

@Inject
public ExperimentalCollaboratorService(ExperimentalCollaboratorDAO experimentalCollaboratorDAO) {
this.experimentalCollaboratorDAO = experimentalCollaboratorDAO;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

-- experiment_id is not tracked in bidb as seperate experiment entities, only in this linking table
CREATE TABLE experiment_program_user_role (
like base_entity INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES,
experiment_id UUID NOT NULL,
program_user_role_id UUID NOT NULL,
like base_edit_track_entity INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES
);
ALTER TABLE experiment_program_user_role ADD FOREIGN KEY (created_by) REFERENCES bi_user (id);
ALTER TABLE experiment_program_user_role ADD FOREIGN KEY (updated_by) REFERENCES bi_user (id);
ALTER TABLE experiment_program_user_role ADD FOREIGN KEY (program_user_role_id) REFERENCES program_user_role (id);
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

DO $$
DECLARE
user_id UUID;
BEGIN

user_id := (SELECT id FROM bi_user WHERE name = 'system');

INSERT INTO role
(domain, created_by, updated_by)
VALUES
('Experimental Collaborator', user_id, user_id)
;

END $$;