Commit 2389571c authored by Francesco Chicchiricco's avatar Francesco Chicchiricco
Browse files

[CRV-17][CRV-19] Adding logic layer

parent 0d9ad1e8
/*
* Copyright 2015 The CHOReVOLUTION project
*
* 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 eu.chorevolution.idm.common;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Collections;
import java.util.Set;
import java.util.TreeSet;
public final class ChorevolutionEntitlement {
public static final String CHOREOGRAPHY_CREATE = "CHOREOGRAPHY_CREATE";
public static final String CHOREOGRAPHY_UPDATE = "CHOREOGRAPHY_UPDATE";
public static final String CHOREOGRAPHY_DELETE = "CHOREOGRAPHY_DELETE";
private static final Set<String> VALUES;
static {
Set<String> values = new TreeSet<>();
for (Field field : ChorevolutionEntitlement.class.getDeclaredFields()) {
if (Modifier.isStatic(field.getModifiers()) && String.class.equals(field.getType())) {
values.add(field.getName());
}
}
VALUES = Collections.unmodifiableSet(values);
}
public static Set<String> values() {
return VALUES;
}
private ChorevolutionEntitlement() {
// private constructor for static utility class
}
}
/*
* Copyright 2015 The CHOReVOLUTION project
*
* 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 eu.chorevolution.idm.common.types;
public enum ChoreographyAction {
PAUSE,
RESUME,
SHUTDOWN,
RELEASE;
}
/*
* Copyright 2015 The CHOReVOLUTION project
*
* 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 eu.chorevolution.idm.common.types;
public enum ServiceAction {
SCALE_UP,
SCALE_DOWN,
SCALE_UP_ACROSS,
SCALE_DOWN_ACROSS,
REPLACE_SERVICE;
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2015 The CHOReVOLUTION project
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>eu.chorevolution.idm.ext</groupId>
<artifactId>syncope-ext-ee</artifactId>
<version>0.1-SNAPSHOT</version>
</parent>
<name>CHOReVOLUTION IdM Extensions: EE Logic</name>
<description>CHOReVOLUTION IdM Extensions: EE Logic</description>
<groupId>eu.chorevolution.idm.ext.ee</groupId>
<artifactId>syncope-ext-ee-logic</artifactId>
<packaging>jar</packaging>
<properties>
<rootpom.basedir>${basedir}/../../..</rootpom.basedir>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.syncope.core</groupId>
<artifactId>syncope-core-logic</artifactId>
<version>${syncope.version}</version>
</dependency>
<dependency>
<groupId>eu.chorevolution.idm</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
/*
* Copyright 2015 The CHOReVOLUTION project
*
* 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.apache.syncope.core.logic;
import eu.chorevolution.idm.common.ChorevolutionEntitlement;
import java.io.InputStream;
import java.lang.reflect.Method;
import org.apache.syncope.common.lib.AbstractBaseBean;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Component;
@Component
public class ChoreographyLogic extends AbstractTransactionalLogic<AbstractBaseBean> {
@PreAuthorize("hasRole('" + ChorevolutionEntitlement.CHOREOGRAPHY_CREATE + "')")
public void create(final String id, final InputStream in) {
}
@PreAuthorize("hasRole('" + ChorevolutionEntitlement.CHOREOGRAPHY_UPDATE + "')")
public void update(final String id, final InputStream in) {
}
@PreAuthorize("hasRole('" + ChorevolutionEntitlement.CHOREOGRAPHY_DELETE + "')")
public void delete(final String id) {
}
@Override
protected AbstractBaseBean resolveReference(final Method method, final Object... args)
throws UnresolvedReferenceException {
throw new UnresolvedReferenceException();
}
}
/*
* Copyright 2015 The CHOReVOLUTION project
*
* 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.apache.syncope.core.logic.init;
import eu.chorevolution.idm.common.ChorevolutionEntitlement;
import org.apache.syncope.core.misc.EntitlementsHolder;
import org.apache.syncope.core.persistence.api.SyncopeLoader;
public class ChoreographyLoader implements SyncopeLoader {
@Override
public Integer getPriority() {
return 1100;
}
@Override
public void load() {
EntitlementsHolder.getInstance().init(ChorevolutionEntitlement.values());
}
}
Supports Markdown
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