The first version of all the ACL VOs and DAOs. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/12b6e700 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/12b6e700 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/12b6e700
Branch: refs/heads/rbac Commit: 12b6e700b638e5712468400de7956a56a02940a5 Parents: 3545886 Author: Min Chen <[email protected]> Authored: Thu Sep 19 17:50:33 2013 -0700 Committer: Min Chen <[email protected]> Committed: Thu Sep 19 17:50:33 2013 -0700 ---------------------------------------------------------------------- .../apache/cloudstack/acl/AclApiPermission.java | 11 +++ .../cloudstack/acl/AclEntityPermission.java | 15 +++ api/src/org/apache/cloudstack/acl/AclGroup.java | 28 ++++++ api/src/org/apache/cloudstack/acl/AclRole.java | 28 ++++++ client/tomcatconf/applicationContext.xml.in | 8 +- .../cloudstack/acl/AclApiPermissionVO.java | 57 ++++++++++++ .../cloudstack/acl/AclEntityPermissionVO.java | 78 ++++++++++++++++ .../cloudstack/acl/AclGroupAccountMapVO.java | 81 +++++++++++++++++ .../cloudstack/acl/AclGroupRoleMapVO.java | 81 +++++++++++++++++ .../org/apache/cloudstack/acl/AclGroupVO.java | 96 ++++++++++++++++++++ .../org/apache/cloudstack/acl/AclRoleVO.java | 96 ++++++++++++++++++++ .../cloudstack/acl/dao/AclApiPermissionDao.java | 31 +++++++ .../acl/dao/AclApiPermissionDaoImpl.java | 68 ++++++++++++++ .../acl/dao/AclEntityPermissionDao.java | 28 ++++++ .../acl/dao/AclEntityPermissionDaoImpl.java | 59 ++++++++++++ .../acl/dao/AclGroupAccountMapDao.java | 31 +++++++ .../acl/dao/AclGroupAccountMapDaoImpl.java | 66 ++++++++++++++ .../apache/cloudstack/acl/dao/AclGroupDao.java | 28 ++++++ .../cloudstack/acl/dao/AclGroupDaoImpl.java | 55 +++++++++++ .../cloudstack/acl/dao/AclGroupRoleMapDao.java | 31 +++++++ .../acl/dao/AclGroupRoleMapDaoImpl.java | 66 ++++++++++++++ .../apache/cloudstack/acl/dao/AclRoleDao.java | 28 ++++++ .../cloudstack/acl/dao/AclRoleDaoImpl.java | 55 +++++++++++ 23 files changed, 1124 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/api/src/org/apache/cloudstack/acl/AclApiPermission.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/acl/AclApiPermission.java b/api/src/org/apache/cloudstack/acl/AclApiPermission.java new file mode 100644 index 0000000..5939e17 --- /dev/null +++ b/api/src/org/apache/cloudstack/acl/AclApiPermission.java @@ -0,0 +1,11 @@ +package org.apache.cloudstack.acl; + +import org.apache.cloudstack.api.InternalIdentity; + +public interface AclApiPermission extends InternalIdentity { + + Long getAclRoleId(); + + String getApiName(); + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/api/src/org/apache/cloudstack/acl/AclEntityPermission.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/acl/AclEntityPermission.java b/api/src/org/apache/cloudstack/acl/AclEntityPermission.java new file mode 100644 index 0000000..2716406 --- /dev/null +++ b/api/src/org/apache/cloudstack/acl/AclEntityPermission.java @@ -0,0 +1,15 @@ +package org.apache.cloudstack.acl; + +import org.apache.cloudstack.acl.SecurityChecker.AccessType; +import org.apache.cloudstack.api.InternalIdentity; + +public interface AclEntityPermission extends InternalIdentity { + + Long getAclGroupId(); + + String getEntityType(); + + Long getEntityId(); + + AccessType getAccessType(); +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/api/src/org/apache/cloudstack/acl/AclGroup.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/acl/AclGroup.java b/api/src/org/apache/cloudstack/acl/AclGroup.java new file mode 100644 index 0000000..bc4732d --- /dev/null +++ b/api/src/org/apache/cloudstack/acl/AclGroup.java @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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.apache.cloudstack.acl; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + +public interface AclGroup extends InternalIdentity, Identity { + + String getName(); + + String getDescription(); + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/api/src/org/apache/cloudstack/acl/AclRole.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/acl/AclRole.java b/api/src/org/apache/cloudstack/acl/AclRole.java new file mode 100644 index 0000000..b4372a4 --- /dev/null +++ b/api/src/org/apache/cloudstack/acl/AclRole.java @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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.apache.cloudstack.acl; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + +public interface AclRole extends InternalIdentity, Identity { + + String getName(); + + String getDescription(); + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/client/tomcatconf/applicationContext.xml.in ---------------------------------------------------------------------- diff --git a/client/tomcatconf/applicationContext.xml.in b/client/tomcatconf/applicationContext.xml.in index 9b6636a..96b0951 100644 --- a/client/tomcatconf/applicationContext.xml.in +++ b/client/tomcatconf/applicationContext.xml.in @@ -369,7 +369,13 @@ <bean id="applicationLbRuleDaoImpl" class="org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDaoImpl" /> <bean id="networkOfferingDetailsDaoImpl" class="com.cloud.offerings.dao.NetworkOfferingDetailsDaoImpl" /> <bean id="serviceOfferingDetailsDaoImpl" class="com.cloud.service.dao.ServiceOfferingDetailsDaoImpl"/> - + <bean id="AclGroupDaoImpl" class="org.apache.cloudstack.acl.dao.AclGroupDaoImpl"/> + <bean id="AclRoleDaoImpl" class="org.apache.cloudstack.acl.dao.AclRoleDaoImpl"/> + <bean id="AclGroupAccountMapDaoImpl" class="org.apache.cloudstack.acl.dao.AclGroupAccountMapDaoImpl"/> + <bean id="AclGroupRoleMapDaoImpl" class="org.apache.cloudstack.acl.dao.AclGroupRoleMapDaoImpl"/> + <bean id="AclApiPermissionDaoImpl" class="org.apache.cloudstack.acl.dao.AclApiPermissionDaoImpl"/> + <bean id="AclEntityPermissionDaoImpl" class="org.apache.cloudstack.acl.dao.AclEntityPermissionDaoImpl"/> + <!-- Checkers --> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/engine/schema/src/org/apache/cloudstack/acl/AclApiPermissionVO.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/acl/AclApiPermissionVO.java b/engine/schema/src/org/apache/cloudstack/acl/AclApiPermissionVO.java new file mode 100644 index 0000000..fbd7c5e --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/acl/AclApiPermissionVO.java @@ -0,0 +1,57 @@ +package org.apache.cloudstack.acl; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +import com.cloud.utils.db.GenericDao; + +@Entity +@Table(name = ("acl_api_permission")) +public class AclApiPermissionVO implements AclApiPermission { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "role_id") + private long aclRoleId; + + @Column(name = "api") + private String apiName; + + @Column(name = GenericDao.REMOVED_COLUMN) + private Date removed; + + @Column(name = GenericDao.CREATED_COLUMN) + private Date created; + + @Override + public long getId() { + return id; + } + + @Override + public Long getAclRoleId() { + return aclRoleId; + } + + @Override + public String getApiName() { + return apiName; + } + + public Date getRemoved() { + return removed; + } + + public Date getCreated() { + return created; + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/engine/schema/src/org/apache/cloudstack/acl/AclEntityPermissionVO.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/acl/AclEntityPermissionVO.java b/engine/schema/src/org/apache/cloudstack/acl/AclEntityPermissionVO.java new file mode 100644 index 0000000..b9e9174 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/acl/AclEntityPermissionVO.java @@ -0,0 +1,78 @@ +package org.apache.cloudstack.acl; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.apache.cloudstack.acl.SecurityChecker.AccessType; + +import com.cloud.utils.db.GenericDao; + +@Entity +@Table(name = ("acl_entity_permission")) +public class AclEntityPermissionVO implements AclEntityPermission { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "group_id") + private long aclGroupId; + + @Column(name = "entity_type") + private String entityType; + + @Column(name = "entity_id") + private Long entityId; + + @Column(name = "access_type") + @Enumerated(value = EnumType.STRING) + AccessType accessType; + + @Column(name = GenericDao.REMOVED_COLUMN) + private Date removed; + + @Column(name = GenericDao.CREATED_COLUMN) + private Date created; + + @Override + public long getId() { + return id; + } + + @Override + public Long getAclGroupId() { + return aclGroupId; + } + + @Override + public String getEntityType() { + return entityType; + } + + @Override + public Long getEntityId() { + return entityId; + } + + @Override + public AccessType getAccessType() { + return accessType; + } + + public Date getRemoved() { + return removed; + } + + public Date getCreated() { + return created; + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/engine/schema/src/org/apache/cloudstack/acl/AclGroupAccountMapVO.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/acl/AclGroupAccountMapVO.java b/engine/schema/src/org/apache/cloudstack/acl/AclGroupAccountMapVO.java new file mode 100644 index 0000000..c239474 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/acl/AclGroupAccountMapVO.java @@ -0,0 +1,81 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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.apache.cloudstack.acl; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.apache.cloudstack.api.InternalIdentity; + +import com.cloud.utils.db.GenericDao; + +@Entity +@Table(name = ("acl_group_account_map")) +public class AclGroupAccountMapVO implements InternalIdentity { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private Long id; + + @Column(name = "group_id") + private long aclGroupId; + + @Column(name = "account_id") + private long accountId; + + @Column(name = GenericDao.REMOVED_COLUMN) + private Date removed; + + @Column(name = GenericDao.CREATED_COLUMN) + private Date created; + + public AclGroupAccountMapVO() { + } + + public AclGroupAccountMapVO(long aclGroupId, long accountId) { + this.aclGroupId = aclGroupId; + this.accountId = accountId; + } + + @Override + public long getId() { + return id; + } + + public long getAclGroupId() { + return aclGroupId; + } + + + public long getAccountId() { + return accountId; + } + + public Date getRemoved() { + return removed; + } + + public Date getCreated() { + return created; + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/engine/schema/src/org/apache/cloudstack/acl/AclGroupRoleMapVO.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/acl/AclGroupRoleMapVO.java b/engine/schema/src/org/apache/cloudstack/acl/AclGroupRoleMapVO.java new file mode 100644 index 0000000..b866524 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/acl/AclGroupRoleMapVO.java @@ -0,0 +1,81 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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.apache.cloudstack.acl; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.apache.cloudstack.api.InternalIdentity; + +import com.cloud.utils.db.GenericDao; + +@Entity +@Table(name = ("acl_group_role_map")) +public class AclGroupRoleMapVO implements InternalIdentity { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private Long id; + + @Column(name = "group_id") + private long aclGroupId; + + @Column(name = "role_id") + private long aclRoleId; + + @Column(name = GenericDao.REMOVED_COLUMN) + private Date removed; + + @Column(name = GenericDao.CREATED_COLUMN) + private Date created; + + public AclGroupRoleMapVO() { + } + + public AclGroupRoleMapVO(long aclGroupId, long aclRoleId) { + this.aclGroupId = aclGroupId; + this.aclRoleId = aclRoleId; + } + + @Override + public long getId() { + return id; + } + + public long getAclGroupId() { + return aclGroupId; + } + + + public long getAclRoleId() { + return aclRoleId; + } + + public Date getRemoved() { + return removed; + } + + public Date getCreated() { + return created; + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/engine/schema/src/org/apache/cloudstack/acl/AclGroupVO.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/acl/AclGroupVO.java b/engine/schema/src/org/apache/cloudstack/acl/AclGroupVO.java new file mode 100644 index 0000000..fbad621 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/acl/AclGroupVO.java @@ -0,0 +1,96 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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.apache.cloudstack.acl; + +import java.util.Date; +import java.util.UUID; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +import com.cloud.utils.db.GenericDao; + +@Entity +@Table(name = ("acl_group")) +public class AclGroupVO implements AclGroup { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "name") + private String name; + + @Column(name = "description") + private String description; + + @Column(name = "uuid") + private String uuid; + + @Column(name = GenericDao.REMOVED_COLUMN) + private Date removed; + + @Column(name = GenericDao.CREATED_COLUMN) + private Date created; + + public AclGroupVO() { + uuid = UUID.randomUUID().toString(); + } + + public AclGroupVO(String name, String description) { + this.name = name; + this.description = description; + uuid = UUID.randomUUID().toString(); + } + + @Override + public long getId() { + return id; + } + + @Override + public String getName() { + return name; + } + + @Override + public String getDescription() { + return description; + } + + + @Override + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public Date getRemoved() { + return removed; + } + + public Date getCreated() { + return created; + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/engine/schema/src/org/apache/cloudstack/acl/AclRoleVO.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/acl/AclRoleVO.java b/engine/schema/src/org/apache/cloudstack/acl/AclRoleVO.java new file mode 100644 index 0000000..5f5fd2c --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/acl/AclRoleVO.java @@ -0,0 +1,96 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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.apache.cloudstack.acl; + +import java.util.Date; +import java.util.UUID; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +import com.cloud.utils.db.GenericDao; + +@Entity +@Table(name = ("acl_role")) +public class AclRoleVO implements AclRole { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "name") + private String name; + + @Column(name = "description") + private String description; + + @Column(name = "uuid") + private String uuid; + + @Column(name = GenericDao.REMOVED_COLUMN) + private Date removed; + + @Column(name = GenericDao.CREATED_COLUMN) + private Date created; + + public AclRoleVO() { + uuid = UUID.randomUUID().toString(); + } + + public AclRoleVO(String name, String description) { + this.name = name; + this.description = description; + uuid = UUID.randomUUID().toString(); + } + + @Override + public long getId() { + return id; + } + + @Override + public String getName() { + return name; + } + + @Override + public String getDescription() { + return description; + } + + + @Override + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public Date getRemoved() { + return removed; + } + + public Date getCreated() { + return created; + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/engine/schema/src/org/apache/cloudstack/acl/dao/AclApiPermissionDao.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/acl/dao/AclApiPermissionDao.java b/engine/schema/src/org/apache/cloudstack/acl/dao/AclApiPermissionDao.java new file mode 100644 index 0000000..b29b17e --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/acl/dao/AclApiPermissionDao.java @@ -0,0 +1,31 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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.apache.cloudstack.acl.dao; + +import java.util.List; + +import org.apache.cloudstack.acl.AclApiPermissionVO; + +import com.cloud.utils.db.GenericDao; + +public interface AclApiPermissionDao extends GenericDao<AclApiPermissionVO, Long> { + + List<AclApiPermissionVO> listByRoleId(long roleId); + + AclApiPermissionVO findByRoleAndApi(long roleId, String api); + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/engine/schema/src/org/apache/cloudstack/acl/dao/AclApiPermissionDaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/acl/dao/AclApiPermissionDaoImpl.java b/engine/schema/src/org/apache/cloudstack/acl/dao/AclApiPermissionDaoImpl.java new file mode 100644 index 0000000..dd6ddec --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/acl/dao/AclApiPermissionDaoImpl.java @@ -0,0 +1,68 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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.apache.cloudstack.acl.dao; + +import java.util.List; +import java.util.Map; + +import javax.naming.ConfigurationException; + +import org.springframework.stereotype.Component; + +import org.apache.cloudstack.acl.AclApiPermissionVO; + +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; + +@Component +public class AclApiPermissionDaoImpl extends GenericDaoBase<AclApiPermissionVO, Long> implements AclApiPermissionDao { + private SearchBuilder<AclApiPermissionVO> findByRoleApi; + private SearchBuilder<AclApiPermissionVO> ListByRoleId; + + @Override + public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { + super.configure(name, params); + + findByRoleApi = createSearchBuilder(); + findByRoleApi.and("roleId", findByRoleApi.entity().getAclRoleId(), SearchCriteria.Op.EQ); + findByRoleApi.and("api", findByRoleApi.entity().getApiName(), SearchCriteria.Op.EQ); + findByRoleApi.done(); + + ListByRoleId = createSearchBuilder(); + ListByRoleId.and("roleId", ListByRoleId.entity().getAclRoleId(), SearchCriteria.Op.EQ); + ListByRoleId.done(); + + return true; + } + + @Override + public AclApiPermissionVO findByRoleAndApi(long roleId, String api) { + SearchCriteria<AclApiPermissionVO> sc = findByRoleApi.create(); + sc.setParameters("roleId", roleId); + sc.setParameters("api", api); + return findOneBy(sc); + } + + @Override + public List<AclApiPermissionVO> listByRoleId(long roleId) { + SearchCriteria<AclApiPermissionVO> sc = ListByRoleId.create(); + sc.setParameters("roleId", roleId); + return listBy(sc); + } + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/engine/schema/src/org/apache/cloudstack/acl/dao/AclEntityPermissionDao.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/acl/dao/AclEntityPermissionDao.java b/engine/schema/src/org/apache/cloudstack/acl/dao/AclEntityPermissionDao.java new file mode 100644 index 0000000..58c3478 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/acl/dao/AclEntityPermissionDao.java @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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.apache.cloudstack.acl.dao; + +import org.apache.cloudstack.acl.AclEntityPermissionVO; +import org.apache.cloudstack.acl.SecurityChecker.AccessType; + +import com.cloud.utils.db.GenericDao; + +public interface AclEntityPermissionDao extends GenericDao<AclEntityPermissionVO, Long> { + + AclEntityPermissionVO findByGroupAndEntity(long groupId, String entityType, long entityId, AccessType accessType); + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/engine/schema/src/org/apache/cloudstack/acl/dao/AclEntityPermissionDaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/acl/dao/AclEntityPermissionDaoImpl.java b/engine/schema/src/org/apache/cloudstack/acl/dao/AclEntityPermissionDaoImpl.java new file mode 100644 index 0000000..71c6e64 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/acl/dao/AclEntityPermissionDaoImpl.java @@ -0,0 +1,59 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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.apache.cloudstack.acl.dao; + +import java.util.Map; + +import javax.naming.ConfigurationException; + +import org.springframework.stereotype.Component; + +import org.apache.cloudstack.acl.AclEntityPermissionVO; +import org.apache.cloudstack.acl.SecurityChecker.AccessType; + +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; + +@Component +public class AclEntityPermissionDaoImpl extends GenericDaoBase<AclEntityPermissionVO, Long> implements AclEntityPermissionDao { + private SearchBuilder<AclEntityPermissionVO> findByGroupEntity; + + @Override + public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { + super.configure(name, params); + + findByGroupEntity = createSearchBuilder(); + findByGroupEntity.and("groupId", findByGroupEntity.entity().getAclGroupId(), SearchCriteria.Op.EQ); + findByGroupEntity.and("entityType", findByGroupEntity.entity().getEntityType(), SearchCriteria.Op.EQ); + findByGroupEntity.and("entityId", findByGroupEntity.entity().getEntityId(), SearchCriteria.Op.EQ); + findByGroupEntity.and("accessType", findByGroupEntity.entity().getAccessType(), SearchCriteria.Op.EQ); + findByGroupEntity.done(); + + return true; + } + + @Override + public AclEntityPermissionVO findByGroupAndEntity(long groupId, String entityType, long entityId, AccessType accessType) { + SearchCriteria<AclEntityPermissionVO> sc = findByGroupEntity.create(); + sc.setParameters("groupId", groupId); + sc.setParameters("entityType", entityType); + sc.setParameters("entityId", entityId); + sc.setParameters("accessType", accessType); + return findOneBy(sc); + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupAccountMapDao.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupAccountMapDao.java b/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupAccountMapDao.java new file mode 100644 index 0000000..b60dcb4 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupAccountMapDao.java @@ -0,0 +1,31 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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.apache.cloudstack.acl.dao; + +import java.util.List; + +import org.apache.cloudstack.acl.AclGroupAccountMapVO; + +import com.cloud.utils.db.GenericDao; + +public interface AclGroupAccountMapDao extends GenericDao<AclGroupAccountMapVO, Long> { + + List<AclGroupAccountMapVO> listByGroupId(long groupId); + + List<AclGroupAccountMapVO> listByAccountId(long accountId); + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupAccountMapDaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupAccountMapDaoImpl.java b/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupAccountMapDaoImpl.java new file mode 100644 index 0000000..ecccf85 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupAccountMapDaoImpl.java @@ -0,0 +1,66 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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.apache.cloudstack.acl.dao; + +import java.util.List; +import java.util.Map; + +import javax.naming.ConfigurationException; + +import org.springframework.stereotype.Component; + +import org.apache.cloudstack.acl.AclGroupAccountMapVO; + +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; + +@Component +public class AclGroupAccountMapDaoImpl extends GenericDaoBase<AclGroupAccountMapVO, Long> implements AclGroupAccountMapDao { + private SearchBuilder<AclGroupAccountMapVO> ListByGroupId; + private SearchBuilder<AclGroupAccountMapVO> ListByAccountId; + + @Override + public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { + super.configure(name, params); + + ListByGroupId = createSearchBuilder(); + ListByGroupId.and("groupId", ListByGroupId.entity().getAclGroupId(), SearchCriteria.Op.EQ); + ListByGroupId.done(); + + ListByAccountId = createSearchBuilder(); + ListByAccountId.and("accountId", ListByAccountId.entity().getAccountId(), SearchCriteria.Op.EQ); + ListByAccountId.done(); + + return true; + } + + @Override + public List<AclGroupAccountMapVO> listByGroupId(long groupId) { + SearchCriteria<AclGroupAccountMapVO> sc = ListByGroupId.create(); + sc.setParameters("groupId", groupId); + return listBy(sc); + } + + @Override + public List<AclGroupAccountMapVO> listByAccountId(long accountId) { + SearchCriteria<AclGroupAccountMapVO> sc = ListByAccountId.create(); + sc.setParameters("accountId", accountId); + return listBy(sc); + } + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupDao.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupDao.java b/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupDao.java new file mode 100644 index 0000000..45494ab --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupDao.java @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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.apache.cloudstack.acl.dao; + +import org.apache.cloudstack.acl.AclGroup; +import org.apache.cloudstack.acl.AclGroupVO; + +import com.cloud.utils.db.GenericDao; + +public interface AclGroupDao extends GenericDao<AclGroupVO, Long> { + + AclGroup findByName(String groupName); + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupDaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupDaoImpl.java b/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupDaoImpl.java new file mode 100644 index 0000000..27b31b5 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupDaoImpl.java @@ -0,0 +1,55 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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.apache.cloudstack.acl.dao; + +import java.util.Map; + +import javax.naming.ConfigurationException; + +import org.springframework.stereotype.Component; + +import org.apache.cloudstack.acl.AclGroup; +import org.apache.cloudstack.acl.AclGroupVO; + +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; + +@Component +public class AclGroupDaoImpl extends GenericDaoBase<AclGroupVO, Long> implements AclGroupDao { + private SearchBuilder<AclGroupVO> nameSearch; + + @Override + public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { + super.configure(name, params); + + nameSearch = createSearchBuilder(); + nameSearch.and("name", nameSearch.entity().getName(), SearchCriteria.Op.EQ); + nameSearch.done(); + + + return true; + } + + @Override + public AclGroup findByName(String name) { + SearchCriteria<AclGroupVO> sc = nameSearch.create(); + sc.setParameters("name", name); + return findOneBy(sc); + } + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupRoleMapDao.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupRoleMapDao.java b/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupRoleMapDao.java new file mode 100644 index 0000000..eb1825f --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupRoleMapDao.java @@ -0,0 +1,31 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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.apache.cloudstack.acl.dao; + +import java.util.List; + +import org.apache.cloudstack.acl.AclGroupRoleMapVO; + +import com.cloud.utils.db.GenericDao; + +public interface AclGroupRoleMapDao extends GenericDao<AclGroupRoleMapVO, Long> { + + List<AclGroupRoleMapVO> listByGroupId(long groupId); + + List<AclGroupRoleMapVO> listByRoleId(long roleId); + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupRoleMapDaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupRoleMapDaoImpl.java b/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupRoleMapDaoImpl.java new file mode 100644 index 0000000..2d58216 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/acl/dao/AclGroupRoleMapDaoImpl.java @@ -0,0 +1,66 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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.apache.cloudstack.acl.dao; + +import java.util.List; +import java.util.Map; + +import javax.naming.ConfigurationException; + +import org.springframework.stereotype.Component; + +import org.apache.cloudstack.acl.AclGroupRoleMapVO; + +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; + +@Component +public class AclGroupRoleMapDaoImpl extends GenericDaoBase<AclGroupRoleMapVO, Long> implements AclGroupRoleMapDao { + private SearchBuilder<AclGroupRoleMapVO> ListByGroupId; + private SearchBuilder<AclGroupRoleMapVO> ListByRoleId; + + @Override + public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { + super.configure(name, params); + + ListByGroupId = createSearchBuilder(); + ListByGroupId.and("groupId", ListByGroupId.entity().getAclGroupId(), SearchCriteria.Op.EQ); + ListByGroupId.done(); + + ListByRoleId = createSearchBuilder(); + ListByRoleId.and("roleId", ListByRoleId.entity().getAclRoleId(), SearchCriteria.Op.EQ); + ListByRoleId.done(); + + return true; + } + + @Override + public List<AclGroupRoleMapVO> listByGroupId(long groupId) { + SearchCriteria<AclGroupRoleMapVO> sc = ListByGroupId.create(); + sc.setParameters("groupId", groupId); + return listBy(sc); + } + + @Override + public List<AclGroupRoleMapVO> listByRoleId(long roleId) { + SearchCriteria<AclGroupRoleMapVO> sc = ListByRoleId.create(); + sc.setParameters("roleId", roleId); + return listBy(sc); + } + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/engine/schema/src/org/apache/cloudstack/acl/dao/AclRoleDao.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/acl/dao/AclRoleDao.java b/engine/schema/src/org/apache/cloudstack/acl/dao/AclRoleDao.java new file mode 100644 index 0000000..c44b4f3 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/acl/dao/AclRoleDao.java @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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.apache.cloudstack.acl.dao; + +import org.apache.cloudstack.acl.AclRole; +import org.apache.cloudstack.acl.AclRoleVO; + +import com.cloud.utils.db.GenericDao; + +public interface AclRoleDao extends GenericDao<AclRoleVO, Long> { + + AclRole findByName(String roleName); + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6e700/engine/schema/src/org/apache/cloudstack/acl/dao/AclRoleDaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/acl/dao/AclRoleDaoImpl.java b/engine/schema/src/org/apache/cloudstack/acl/dao/AclRoleDaoImpl.java new file mode 100644 index 0000000..da84eab --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/acl/dao/AclRoleDaoImpl.java @@ -0,0 +1,55 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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.apache.cloudstack.acl.dao; + +import java.util.Map; + +import javax.naming.ConfigurationException; + +import org.springframework.stereotype.Component; + +import org.apache.cloudstack.acl.AclRole; +import org.apache.cloudstack.acl.AclRoleVO; + +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; + +@Component +public class AclRoleDaoImpl extends GenericDaoBase<AclRoleVO, Long> implements AclRoleDao { + private SearchBuilder<AclRoleVO> nameSearch; + + @Override + public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { + super.configure(name, params); + + nameSearch = createSearchBuilder(); + nameSearch.and("name", nameSearch.entity().getName(), SearchCriteria.Op.EQ); + nameSearch.done(); + + + return true; + } + + @Override + public AclRole findByName(String name) { + SearchCriteria<AclRoleVO> sc = nameSearch.create(); + sc.setParameters("name", name); + return findOneBy(sc); + } + +}
