Commit 10652210 authored by Valentin Suhnjov's avatar Valentin Suhnjov

RIHAKB-149. Remove Role_right and corresponding DB tables

parent 0de8fa50
alter table riha.role_right add CONSTRAINT fk_role_rights_kind FOREIGN KEY (kind_id)
REFERENCES riha.kind (kind_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION;
alter table riha.main_resource add CONSTRAINT fk_kind FOREIGN KEY (kind_id)
REFERENCES riha.kind (kind_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION;
......
......@@ -58,19 +58,6 @@ START 436069
CACHE 1;
GRANT SELECT, USAGE ON SEQUENCE riha.main_resource_seq TO riha;
-- Sequence: riha.role_right_seq
-- DROP SEQUENCE riha.role_right_seq;
CREATE SEQUENCE riha.role_right_seq
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 338
CACHE 1;
GRANT SELECT, USAGE ON SEQUENCE riha.role_right_seq TO riha;
-- Table: riha.kind
-- DROP TABLE riha.kind;
......@@ -105,50 +92,6 @@ COMMENT ON COLUMN riha.kind.modified_date IS 'Kirje muutmise ajamoment';
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE riha.kind TO riha;
-- Table:fdsfdsff riha.role_right
-- DROP TABLE riha.role_right;
CREATE TABLE riha.role_right
(
role_right_id integer NOT NULL,
kind_id integer NOT NULL, -- Objekti liik, millele antud õigus rakendub.
role_name character varying(50) NOT NULL, -- Rolli nimi, mille korral antud õigus kehtib.
access_restriction integer NOT NULL, -- Juurdepääsupiirang, mille suhtes õigus rakendub. Kui väärtus on võrdne või suurem objekti vastava välja väärtusest, siis rakendub antud õigus sellele objektile.
read integer NOT NULL, -- 0-õigus puudub 1-õigus oma objektide suhtes 2-õigus kõikide objektide suhtes
"create" integer NOT NULL, -- 0-õigus puudub 1-õigus oma objektide suhtes 2-õigus kõikide objektide suhtes
update integer NOT NULL, -- 0-õigus puudub 1-õigus oma objektide suhtes 2-õigus kõikide objektide suhtes
delete integer NOT NULL, -- 0-õigus puudub 1-õigus oma objektide suhtes 2-õigus kõikide objektide suhtes
CONSTRAINT pk_user_rights PRIMARY KEY (role_right_id),
CONSTRAINT fk_role_rights_kind FOREIGN KEY (kind_id)
REFERENCES riha.kind (kind_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (
OIDS=FALSE
);
COMMENT ON COLUMN riha.role_right.kind_id IS 'Objekti liik, millele antud õigus rakendub.';
COMMENT ON COLUMN riha.role_right.role_name IS 'Rolli nimi, mille korral antud õigus kehtib.';
COMMENT ON COLUMN riha.role_right.access_restriction IS 'Juurdepääsupiirang, mille suhtes õigus rakendub. Kui väärtus on võrdne või suurem objekti vastava välja väärtusest, siis rakendub antud õigus sellele objektile.';
COMMENT ON COLUMN riha.role_right.read IS '0-õigus puudub 1-õigus oma objektide suhtes 2-õigus kõikide objektide suhtes';
COMMENT ON COLUMN riha.role_right."create" IS '0-õigus puudub 1-õigus oma objektide suhtes 2-õigus kõikide objektide suhtes';
COMMENT ON COLUMN riha.role_right.update IS '0-õigus puudub 1-õigus oma objektide suhtes 2-õigus kõikide objektide suhtes';
COMMENT ON COLUMN riha.role_right.delete IS '0-õigus puudub 1-õigus oma objektide suhtes 2-õigus kõikide objektide suhtes';
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE riha.role_right TO riha;
-- Index: riha.ixfk_user_rights_kind
-- DROP INDEX riha.ixfk_user_rights_kind;
CREATE INDEX ixfk_user_rights_kind
ON riha.role_right
USING btree
(kind_id);
-- Table: riha.main_resource
-- DROP TABLE riha.main_resource;
......
alter table riha.role_right drop constraint fk_role_rights_kind;
alter table riha.main_resource drop constraint fk_kind;
alter table riha.main_resource drop constraint fk_main_resource_main_resource_02;
alter table riha.data_object drop constraint fk_data_object_data_object;
......
......@@ -38,20 +38,10 @@ DROP INDEX riha.ixfk_main_resource_main_resource;
DROP TABLE riha.main_resource;
-- Index: riha.ixfk_user_rights_kind
DROP INDEX riha.ixfk_user_rights_kind;
-- Table: riha.role_right
DROP TABLE riha.role_right;
-- Table: riha.kind
DROP TABLE riha.kind;
-- Sequence: riha.comment_seq
DROP SEQUENCE riha.comment_seq;
......@@ -71,7 +61,3 @@ DROP SEQUENCE riha.kind_seq;
-- Sequence: riha.main_resource_seq
DROP SEQUENCE riha.main_resource_seq;
-- Sequence: riha.role_right_seq
DROP SEQUENCE riha.role_right_seq;
package ee.eesti.riha.rest.model.readonly;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.Immutable;
import org.springframework.transaction.annotation.Transactional;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import ee.eesti.riha.rest.model.util.FieldIsPK;
// TODO: Auto-generated Javadoc
/**
* The Class Role_right.
*/
@Transactional
@Entity
@Table(name = "role_right")
@JsonInclude(Include.NON_NULL)
@Immutable
public class Role_right {
@FieldIsPK
@Id
private Integer role_right_id;
private Integer kind_id;
private String role_name;
private Integer access_restriction;
private Integer read;
private Integer create;
private Integer update;
private Integer delete;
public Role_right() {
}
/**
* @param role_right_id
* @param kind_id
* @param role_name
* @param access_restriction
* @param read
* @param create
* @param update
* @param delete
*/
public Role_right(Integer role_right_id, Integer kind_id, String role_name, Integer access_restriction,
Integer read, Integer create, Integer update, Integer delete) {
this.role_right_id = role_right_id;
this.kind_id = kind_id;
this.role_name = role_name;
this.access_restriction = access_restriction;
this.read = read;
this.create = create;
this.update = update;
this.delete = delete;
}
/**
* Gets the role_right_id.
*
* @return the role_right_id
*/
public Integer getRole_right_id() {
return role_right_id;
}
/**
* Gets the kind_id.
*
* @return the kind_id
*/
public Integer getKind_id() {
return kind_id;
}
/**
* Gets the role_name.
*
* @return the role_name
*/
public String getRole_name() {
return role_name;
}
/**
* Gets the access_restriction.
*
* @return the access_restriction
*/
public Integer getAccess_restriction() {
return access_restriction;
}
/**
* Gets the read.
*
* @return the read
*/
public Integer getRead() {
return read;
}
/**
* Gets the creates the.
*
* @return the creates the
*/
public Integer getCreate() {
return create;
}
/**
* Gets the update.
*
* @return the update
*/
public Integer getUpdate() {
return update;
}
/**
* Gets the delete.
*
* @return the delete
*/
public Integer getDelete() {
return delete;
}
}
......@@ -17,7 +17,6 @@ import ee.eesti.riha.rest.error.RihaRestException;
import ee.eesti.riha.rest.logic.MyExceptionHandler;
import ee.eesti.riha.rest.logic.Validator;
import ee.eesti.riha.rest.model.readonly.Kind;
import ee.eesti.riha.rest.model.readonly.Role_right;
import ee.eesti.riha.rest.service.ApiTableService;
// TODO: Auto-generated Javadoc
......@@ -35,7 +34,6 @@ public class ApiTableServiceImpl<T> implements ApiTableService {
static {
fullScanTables.put(Kind.class.getSimpleName().toLowerCase(), Kind.class);
fullScanTables.put(Role_right.class.getSimpleName().toLowerCase(), Role_right.class);
}
@Autowired
......
......@@ -26,9 +26,6 @@
<bean
class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean"
name="kinds" />
<bean
class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean"
name="role_rights" />
</set>
</property>
</bean>
......
......@@ -36,7 +36,6 @@
<value>ee.eesti.riha.rest.model.readonly.Kind</value>
<value>ee.eesti.riha.rest.model.readonly.Isik</value>
<value>ee.eesti.riha.rest.model.readonly.Asutus</value>
<value>ee.eesti.riha.rest.model.readonly.Role_right</value>
</list>
</property>
<property name="hibernateProperties">
......
......@@ -23,7 +23,6 @@ import ee.eesti.riha.rest.error.RihaRestError;
import ee.eesti.riha.rest.integration.IntegrationTestHelper;
import ee.eesti.riha.rest.logic.Finals;
import ee.eesti.riha.rest.model.readonly.Kind;
import ee.eesti.riha.rest.model.readonly.Role_right;
import ee.eesti.riha.rest.service.ApiClassicService;
import ee.eesti.riha.rest.service.ApiTableService;
import ee.eesti.riha.rest.service.FileService;
......@@ -53,15 +52,6 @@ public class TestApiTableServiceImpl {
assertFalse(kinds.isEmpty());
}
@Test
public void testWorksWithRole_right() throws Exception {
Response response = serviceUnderTest.getFullTable("Role_right");
List<Role_right> role_rights = TestHelper.getObjectsFromClient(response);
assertNotNull(role_rights);
assertFalse(role_rights.isEmpty());
}
@Test
public void testError_withWrongTableName() throws Exception {
Response response = serviceUnderTest.getFullTable("asdasd");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment