mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-03 10:53:49 +00:00
moved DefaultRoles to com.sap.sse.seucrity
This commit is contained in:
1 parent
844c6752ba
commit
e8c059e83e
4 files changed
+27
-12
No files matched your search
+1
-1
@@ -24,9 +24,9 @@ import org.osgi.util.tracker.ServiceTracker;
|
|||||||
|
|
||||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
import com.sap.sse.security.Credential;
|
import com.sap.sse.security.Credential;
|
||||||
|
import com.sap.sse.security.DefaultRoles;
|
||||||
import com.sap.sse.security.SecurityService;
|
import com.sap.sse.security.SecurityService;
|
||||||
import com.sap.sse.security.SessionUtils;
|
import com.sap.sse.security.SessionUtils;
|
||||||
import com.sap.sse.security.ui.client.DefaultRoles;
|
|
||||||
import com.sap.sse.security.ui.oauth.client.CredentialDTO;
|
import com.sap.sse.security.ui.oauth.client.CredentialDTO;
|
||||||
import com.sap.sse.security.ui.oauth.client.SocialUserDTO;
|
import com.sap.sse.security.ui.oauth.client.SocialUserDTO;
|
||||||
import com.sap.sse.security.ui.oauth.shared.OAuthException;
|
import com.sap.sse.security.ui.oauth.shared.OAuthException;
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.sap.sse.security;
|
||||||
|
|
||||||
|
public enum DefaultRoles {
|
||||||
|
ADMIN("admin");
|
||||||
|
|
||||||
|
private DefaultRoles(String rolename) {
|
||||||
|
this.rolename = rolename;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRolename() {
|
||||||
|
return rolename;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final String rolename;
|
||||||
|
}
|
||||||
@@ -19,7 +19,7 @@ public interface SecurityService {
|
|||||||
|
|
||||||
Collection<User> getUserList();
|
Collection<User> getUserList();
|
||||||
|
|
||||||
User getUserByName(String name);
|
User getUserByName(String username);
|
||||||
|
|
||||||
User getCurrentUser();
|
User getCurrentUser();
|
||||||
|
|
||||||
@@ -34,17 +34,17 @@ public interface SecurityService {
|
|||||||
|
|
||||||
void logout();
|
void logout();
|
||||||
|
|
||||||
User createSimpleUser(String name, String email, String password) throws UserManagementException;
|
User createSimpleUser(String username, String email, String password) throws UserManagementException;
|
||||||
|
|
||||||
User createSocialUser(String name, SocialUserAccount socialUserAccount) throws UserManagementException;
|
User createSocialUser(String username, SocialUserAccount socialUserAccount) throws UserManagementException;
|
||||||
|
|
||||||
void deleteUser(String username) throws UserManagementException;
|
void deleteUser(String username) throws UserManagementException;
|
||||||
|
|
||||||
Set<String> getRolesFromUser(String name) throws UserManagementException;
|
Set<String> getRolesFromUser(String username) throws UserManagementException;
|
||||||
|
|
||||||
void addRoleForUser(String name, String role) throws UserManagementException;
|
void addRoleForUser(String username, String role) throws UserManagementException;
|
||||||
|
|
||||||
void removeRoleFromUser(String name, String role) throws UserManagementException;
|
void removeRoleFromUser(String username, String role) throws UserManagementException;
|
||||||
|
|
||||||
void addSetting(String key, Class<?> clazz) throws UserManagementException;
|
void addSetting(String key, Class<?> clazz) throws UserManagementException;
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public class SecurityServiceImpl extends RemoteServiceServlet implements Securit
|
|||||||
try {
|
try {
|
||||||
logger.info("No users found, creating default user \"admin\" with password \"admin\"");
|
logger.info("No users found, creating default user \"admin\" with password \"admin\"");
|
||||||
createSimpleUser("admin", "nobody@sapsailing.com", "admin");
|
createSimpleUser("admin", "nobody@sapsailing.com", "admin");
|
||||||
addRoleForUser("admin", "admin");
|
addRoleForUser("admin", DefaultRoles.ADMIN.getRolename());
|
||||||
addRoleForUser("admin", "moderator");
|
addRoleForUser("admin", "moderator");
|
||||||
} catch (UserManagementException e) {
|
} catch (UserManagementException e) {
|
||||||
logger.log(Level.SEVERE, "Exception while creating default admin user", e);
|
logger.log(Level.SEVERE, "Exception while creating default admin user", e);
|
||||||
@@ -188,13 +188,13 @@ public class SecurityServiceImpl extends RemoteServiceServlet implements Securit
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addRoleForUser(String name, String role) throws UserManagementException {
|
public void addRoleForUser(String username, String role) throws UserManagementException {
|
||||||
store.addRoleForUser(name, role);
|
store.addRoleForUser(username, role);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeRoleFromUser(String name, String role) throws UserManagementException {
|
public void removeRoleFromUser(String username, String role) throws UserManagementException {
|
||||||
store.removeRoleFromUser(name, role);
|
store.removeRoleFromUser(username, role);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in new issue
Block a user