Added scopes to APIs

revert-70aa11f8
mharindu 9 years ago
parent ff82accb48
commit aa6085ac8c

@ -79,7 +79,7 @@
<copy todir="${basedir}/../../../repository/deployment/server/webapps" <copy todir="${basedir}/../../../repository/deployment/server/webapps"
overwrite="true"> overwrite="true">
<fileset dir="${basedir}/target"> <fileset dir="${basedir}/target">
<include name="api#scep-mgt#v1.0.war"/> <include name="api-scep-mgt-v1.0.war"/>
</fileset> </fileset>
</copy> </copy>
</tasks> </tasks>

@ -48,7 +48,7 @@
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>
<configuration> <configuration>
<packagingExcludes>WEB-INF/lib/*cxf*.jar</packagingExcludes> <packagingExcludes>WEB-INF/lib/*cxf*.jar</packagingExcludes>
<warName>api#certificate-mgt#v1.0</warName> <warName>api-certificate-mgt-v1.0</warName>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
@ -75,7 +75,7 @@
<copy todir="${basedir}/../../../repository/deployment/server/webapps" <copy todir="${basedir}/../../../repository/deployment/server/webapps"
overwrite="true"> overwrite="true">
<fileset dir="${basedir}/target"> <fileset dir="${basedir}/target">
<include name="api#certificate-mgt#v1.0.war"/> <include name="api-certificate-mgt-v1.0.war"/>
</fileset> </fileset>
</copy> </copy>
</tasks> </tasks>

@ -1,6 +1,7 @@
package org.wso2.carbon.certificate.mgt.cert.jaxrs.api; package org.wso2.carbon.certificate.mgt.cert.jaxrs.api;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Permission; import org.wso2.carbon.apimgt.annotations.api.Permission;
import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.CertificateList; import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.CertificateList;
import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.EnrollmentCertificate; import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.EnrollmentCertificate;
@ -11,6 +12,10 @@ import javax.ws.rs.*;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@API(name = "Certificate Management", version = "1.0.0",
context = "api-device-mgt-android-v1.0/admin/certificates",
tags = {"devicemgt_admin"})
@Api(value = "Certificate Management", description = "This API carries all certificate management related operations " + @Api(value = "Certificate Management", description = "This API carries all certificate management related operations " +
"such as get all the available devices, etc.") "such as get all the available devices, etc.")
@Path("/admin/certificates") @Path("/admin/certificates")
@ -72,7 +77,7 @@ public interface CertificateManagementAdminService {
message = "Internal Server Error. \n Server error occurred while adding certificates.", message = "Internal Server Error. \n Server error occurred while adding certificates.",
response = ErrorResponse.class) response = ErrorResponse.class)
}) })
@Permission(scope = "certificate-modify", roles = {"admin"}) @Permission(scope = "certificate:add", roles = {"admin"})
Response addCertificate( Response addCertificate(
@ApiParam( @ApiParam(
name = "enrollmentCertificates", name = "enrollmentCertificates",
@ -130,7 +135,7 @@ public interface CertificateManagementAdminService {
"Server error occurred while retrieving information requested certificate.", "Server error occurred while retrieving information requested certificate.",
response = ErrorResponse.class) response = ErrorResponse.class)
}) })
@Permission(scope = "certificate-view", roles = {"emm-admin"}) @Permission(scope = "certificate:view", roles = {"admin"})
Response getCertificate( Response getCertificate(
@ApiParam(name = "serialNumber", @ApiParam(name = "serialNumber",
value = "Provide the serial number of the certificate that you wish to get the details of", value = "Provide the serial number of the certificate that you wish to get the details of",
@ -202,7 +207,7 @@ public interface CertificateManagementAdminService {
"Server error occurred while retrieving all certificates enrolled in the system.", "Server error occurred while retrieving all certificates enrolled in the system.",
response = ErrorResponse.class) response = ErrorResponse.class)
}) })
@Permission(scope = "certificate-view", roles = {"emm-admin"}) @Permission(scope = "certificate:view", roles = {"admin"})
Response getAllCertificates( Response getAllCertificates(
@ApiParam( @ApiParam(
name = "offset", name = "offset",
@ -245,7 +250,7 @@ public interface CertificateManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while removing the certificate.", "Server error occurred while removing the certificate.",
response = ErrorResponse.class)}) response = ErrorResponse.class)})
@Permission(scope = "certificate-modify", roles = {"emm-admin"}) @Permission(scope = "certificate:modify", roles = {"admin"})
Response removeCertificate( Response removeCertificate(
@ApiParam( @ApiParam(
name = "serialNumber", name = "serialNumber",

@ -142,8 +142,7 @@ public interface NotificationManagementService {
message = "Error occurred while updating notification status.") message = "Error occurred while updating notification status.")
} }
) )
@Permission(scope = "notification:modify", roles = {"admin"} @Permission(scope = "notification:view", roles = {"admin"})
)
Response updateNotificationStatus( Response updateNotificationStatus(
@ApiParam( @ApiParam(
name = "id", name = "id",

@ -77,7 +77,7 @@ public interface RoleManagementService {
message = "Internal Server Error. \n Server error occurred while fetching requested list of roles.", message = "Internal Server Error. \n Server error occurred while fetching requested list of roles.",
response = ErrorResponse.class) response = ErrorResponse.class)
}) })
@Permission(scope = "roles:list", roles = {"admin"}) @Permission(scope = "role:list", roles = {"admin"})
Response getRoles( Response getRoles(
@ApiParam( @ApiParam(
name = "filter", name = "filter",
@ -159,7 +159,7 @@ public interface RoleManagementService {
message = "Internal Server ErrorResponse. \n Server error occurred while fetching the permission list of the requested role.", message = "Internal Server ErrorResponse. \n Server error occurred while fetching the permission list of the requested role.",
response = ErrorResponse.class) response = ErrorResponse.class)
}) })
@Permission(scope = "roles:view", roles = {"admin"}) @Permission(scope = "role:view", roles = {"admin"})
Response getPermissionsOfRole( Response getPermissionsOfRole(
@ApiParam( @ApiParam(
name = "roleName", name = "roleName",
@ -222,7 +222,7 @@ public interface RoleManagementService {
"requested role.", "requested role.",
response = ErrorResponse.class) response = ErrorResponse.class)
}) })
@Permission(scope = "roles:view", roles = {"admin"}) @Permission(scope = "role:view", roles = {"admin"})
Response getRole( Response getRole(
@ApiParam( @ApiParam(
name = "roleName", name = "roleName",
@ -282,7 +282,7 @@ public interface RoleManagementService {
message = "Internal Server Error. \n Server error occurred while adding a new role.", message = "Internal Server Error. \n Server error occurred while adding a new role.",
response = ErrorResponse.class) response = ErrorResponse.class)
}) })
@Permission(scope = "roles:add", roles = {"admin"}) @Permission(scope = "role:add", roles = {"admin"})
Response addRole( Response addRole(
@ApiParam( @ApiParam(
name = "role", name = "role",
@ -332,7 +332,7 @@ public interface RoleManagementService {
message = "Internal Server Error. \n Server error occurred while updating the role.", message = "Internal Server Error. \n Server error occurred while updating the role.",
response = ErrorResponse.class) response = ErrorResponse.class)
}) })
@Permission(scope = "roles:modify", roles = {"admin"}) @Permission(scope = "role:modify", roles = {"admin"})
Response updateRole( Response updateRole(
@ApiParam( @ApiParam(
name = "roleName", name = "roleName",
@ -369,7 +369,7 @@ public interface RoleManagementService {
message = "Internal Server Error. \n Server error occurred while removing the role.", message = "Internal Server Error. \n Server error occurred while removing the role.",
response = ErrorResponse.class) response = ErrorResponse.class)
}) })
@Permission(scope = "roles:modify", roles = {"admin"}) @Permission(scope = "role:modify", roles = {"admin"})
Response deleteRole( Response deleteRole(
@ApiParam( @ApiParam(
name = "roleName", name = "roleName",
@ -427,7 +427,7 @@ public interface RoleManagementService {
"Server error occurred while updating the user list of the role.", "Server error occurred while updating the user list of the role.",
response = ErrorResponse.class) response = ErrorResponse.class)
}) })
@Permission(scope = "roles:modify", roles = {"admin"}) @Permission(scope = "role:add", roles = {"admin"})
Response updateUsersOfRole( Response updateUsersOfRole(
@ApiParam( @ApiParam(
name = "roleName", name = "roleName",

@ -82,7 +82,7 @@ public interface UserManagementService {
message = "Internal Server Error. \n Server error occurred while adding a new user.", message = "Internal Server Error. \n Server error occurred while adding a new user.",
response = ErrorResponse.class) response = ErrorResponse.class)
}) })
@Permission(scope = "user-modify", roles = {"emm-admin"}) @Permission(scope = "user:add", roles = {"admin"})
Response addUser( Response addUser(
@ApiParam( @ApiParam(
name = "user", name = "user",
@ -134,7 +134,7 @@ public interface UserManagementService {
" fetching the requested user.", " fetching the requested user.",
response = ErrorResponse.class) response = ErrorResponse.class)
}) })
@Permission(scope = "user-view", roles = {"emm-admin"}) @Permission(scope = "user:view", roles = {"admin"})
Response getUser( Response getUser(
@ApiParam( @ApiParam(
name = "username", name = "username",
@ -191,7 +191,7 @@ public interface UserManagementService {
"Server error occurred while updating the user.", "Server error occurred while updating the user.",
response = ErrorResponse.class) response = ErrorResponse.class)
}) })
@Permission(scope = "user-modify", roles = {"emm-admin"}) @Permission(scope = "user:modify", roles = {"admin"})
Response updateUser( Response updateUser(
@ApiParam( @ApiParam(
name = "username", name = "username",
@ -226,7 +226,7 @@ public interface UserManagementService {
response = ErrorResponse.class response = ErrorResponse.class
) )
}) })
@Permission(scope = "user-modify", roles = {"emm-admin"}) @Permission(scope = "user:modify", roles = {"admin"})
Response removeUser( Response removeUser(
@ApiParam(name = "username", value = "Username of the user to be deleted.", required = true) @ApiParam(name = "username", value = "Username of the user to be deleted.", required = true)
@PathParam("username") String username); @PathParam("username") String username);
@ -275,7 +275,7 @@ public interface UserManagementService {
" assigned to the user.", " assigned to the user.",
response = ErrorResponse.class) response = ErrorResponse.class)
}) })
@Permission(scope = "user-view", roles = {"emm-admin"}) @Permission(scope = "user:view", roles = {"admin"})
Response getRolesOfUser( Response getRolesOfUser(
@ApiParam(name = "username", value = "Username of the user.", required = true) @ApiParam(name = "username", value = "Username of the user.", required = true)
@PathParam("username") String username); @PathParam("username") String username);
@ -318,7 +318,7 @@ public interface UserManagementService {
message = "Internal Server Error. \n Server error occurred while fetching the user list.", message = "Internal Server Error. \n Server error occurred while fetching the user list.",
response = ErrorResponse.class) response = ErrorResponse.class)
}) })
@Permission(scope = "user-view", roles = {"emm-admin"}) @Permission(scope = "user:list", roles = {"admin"})
Response getUsers( Response getUsers(
@ApiParam( @ApiParam(
name = "filter", name = "filter",
@ -385,7 +385,7 @@ public interface UserManagementService {
"list that matches the given filter.", "list that matches the given filter.",
response = ErrorResponse.class) response = ErrorResponse.class)
}) })
@Permission(scope = "user-view", roles = {"emm-admin"}) @Permission(scope = "user:view", roles = {"admin"})
Response getUserNames( Response getUserNames(
@ApiParam( @ApiParam(
name = "filter", name = "filter",
@ -439,7 +439,7 @@ public interface UserManagementService {
"Server error occurred while updating credentials of the user.", "Server error occurred while updating credentials of the user.",
response = ErrorResponse.class) response = ErrorResponse.class)
}) })
@Permission(scope = "user-modify", roles = {"emm-admin"}) @Permission(scope = "user:modify", roles = {"admin"})
Response resetPassword( Response resetPassword(
@ApiParam( @ApiParam(
name = "username", name = "username",

@ -59,7 +59,7 @@
<outputDirectory> <outputDirectory>
${project.build.directory}/maven-shared-archive-resources/webapps ${project.build.directory}/maven-shared-archive-resources/webapps
</outputDirectory> </outputDirectory>
<destFileName>api#certificate-mgt#v1.0.war</destFileName> <destFileName>api-certificate-mgt-v1.0.war</destFileName>
</artifactItem> </artifactItem>
</artifactItems> </artifactItems>
</configuration> </configuration>

@ -1,2 +1,2 @@
instructions.configure = \ instructions.configure = \
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.certificate.mgt.cert.admin.api_${feature.version}/webapps/api#certificate-mgt#v1.0.war,target:${installFolder}/../../deployment/server/webapps/api#certificate-mgt#v1.0.war,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.certificate.mgt.cert.admin.api_${feature.version}/webapps/api-certificate-mgt-v1.0.war,target:${installFolder}/../../deployment/server/webapps/api-certificate-mgt-v1.0.war,overwrite:true);\
Loading…
Cancel
Save