This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<g:form> | |
<g:submitToRemote value="Check Pending Connnections" | |
url="[controller: 'profile', action: 'pending_connections']" | |
update="pending_connections_list" /> | |
</g:form> | |
<div id="pending_connections_list"> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<b>Pending Connections List</b> | |
<table> | |
<g:each var="user" in="${pending_connections}"> | |
<g:form> | |
<tr> | |
<td>${user}</td> | |
<td><div id="accept_connection-${user}"> | |
<g:submitToRemote value="Accept Connection" | |
url="[controller: 'profile', action: 'accept_connection']" | |
update="accept_connection-${user}" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def accept_connection = { | |
def user1 = session.user.attach() | |
user1.connections_requested_by.remove(params.profile_username) | |
user1.connections.add(profile_username) | |
user1.save() | |
User user2 = User.findByUsername(params.profile_username) | |
user2.connections.requested_to.remove(user1.username) | |
user2.save() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def accept_connection = { | |
def user1 = session.user.attach() | |
user1.connections_requested_by.remove(params.profile_username) | |
user1.connections.add(profile_username) | |
user1.save() | |
User user2 = User.findByUsername(params.profile_username) | |
user2.connections.requested_to.remove(user1.username) | |
user2.save() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pending_connections = { | |
def user = session.user.attach() | |
render (template: 'pending-connections', | |
model: [pending_connections : user.connections_requested_by]) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<mvc:annotation-driven /> | |
<context:component-scan base-package="com.myproject"/> | |
<http auto-config="true" use-expressions="true"> | |
<intercept-url pattern="/index" access="permitAll"/> | |
<intercept-url pattern="/login" access="permitAll"/> | |
<intercept-url pattern="/**" access="hasRole('ROLE_USER') or hasRole('ROLE_ADMIN') and fullyAuthenticated" /> | |
<form-login login-page="/login" default-target-url="/home"/> | |
<logout invalidate-session="true" logout-url="/logout" logout-success-url="/"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class User implements Serializable, UserDetails { | |
// Spring Security props | |
private transient Collection<GrantedAuthority> authorities; | |
public void setUserAuthorities(Collection<Role> roles) { | |
List<GrantedAuthority> listOfAuthorities = new ArrayList<GrantedAuthority>(); | |
for (Role role : roles) { | |
listOfAuthorities.add(new GrantedAuthorityImpl(role.getRole())); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
public class UserServiceImpl implements UserDetailsService { | |
@Autowired | |
private UserDao userDao; | |
@Autowired | |
private RoleDao roleDao; | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
public class UserServiceImpl implements UserDetailsService { | |
@Autowired | |
private UserDao userDao; | |
@Autowired | |
private RoleDao roleDao; | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="j_spring_security_check" method="post"> | |
<table style="background-color:#E9FFFF;border:#CCABC1 5px solid;" cellspacing="2" cellpadding="5"> | |
<tr> | |
<td> | |
<label for="j_username">Login</label>: | |
<input id="j_username" name="j_username" size="20" maxlength="50" type="text"/> | |
</td> | |
</tr> |
OlderNewer