Commit d322dc56 authored by Matija Obreza's avatar Matija Obreza
Browse files

List ACL SIDs by their IDs

parent 53607dd1
......@@ -21,6 +21,9 @@ import javax.persistence.Table;
import org.genesys.blocks.model.BasicModel;
/**
* ACL Class provides a unique identifier for ACL-aware entity types.
*/
@Entity
@Table(name = "acl_class")
public class AclClass extends BasicModel {
......
/*
* Copyright 2017 Global Crop Diversity Trust
*
* 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.genesys.blocks.security.model;
import javax.persistence.CascadeType;
......@@ -11,6 +26,9 @@ import javax.persistence.UniqueConstraint;
import org.genesys.blocks.model.BasicModel;
/**
* ACL Entry represents permissions of {@link AclSid} on a particular entity (through {@link AclObjectIdentity}).
*/
@Entity
@Table(name = "acl_entry", uniqueConstraints = @UniqueConstraint(columnNames = { "acl_object_identity", "ace_order" }))
public class AclEntry extends BasicModel {
......
/*
* Copyright 2017 Global Crop Diversity Trust
*
* 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.genesys.blocks.security.model;
import java.util.List;
......@@ -16,6 +31,11 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import org.genesys.blocks.model.BasicModel;
/**
* ACL Object Identity represents a specific ACL-aware entity (combination of {@link AclClass} and {#link objectIdIdentity}).
*
* It records the owner of the entity and entity's parent object if any.
*/
@Entity
@Table(name = "acl_object_identity", uniqueConstraints = @UniqueConstraint(columnNames = { "object_id_class", "object_id_identity" }))
public class AclObjectIdentity extends BasicModel {
......
/*
* Copyright 2017 Global Crop Diversity Trust
*
* 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.genesys.blocks.security.model;
import java.util.List;
......@@ -13,6 +28,9 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import org.genesys.blocks.model.BasicModel;
/**
* ACL SID uniquely identifies any principal or authority in the system ("SID" stands for "security identity").
*/
@Entity
@Table(name = "acl_sid")
public class AclSid extends BasicModel {
......
/*
* Copyright 2017 Global Crop Diversity Trust
*
* 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.genesys.blocks.security.persistence;
import org.genesys.blocks.security.model.AclSid;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
public interface AclSidPersistence extends JpaRepository<AclSid, Long> {
AclSid findBySidAndPrincipal(String sid, boolean principal);
/**
* List ACL SIDs with internal identifiers.
*
* @param ids internal (database) SID identifiers
* @return ACL SIDs for specified identifiers
*/
@Query("select distinct sid from AclSid sid where sid.id in :ids")
List<AclSid> listById(@Param("ids") Iterable<Long> ids);
}
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