Партнерка на США и Канаду по недвижимости, выплаты в крипто
- 30% recurring commission
- Выплаты в USDT
- Вывод каждую неделю
- Комиссия до 5 лет за каждого referral
*/
def create = {
[authority: new Role()]
}
/**
* Save a new authority.
*/
def save = {
def authority = new Role()
authority. properties = params
if (authority. save()) {
redirect action: show, id: authority. id
}
else {
render view: 'create', model: [authority: authority]
}
}
}
package soc
class SecretController {
def index() { }
}
package soc
import javax. servlet. http. HttpServletResponse
class UserController {
def scaffold = true
def authenticateService
def rolesService
def secureService
def register = {
if (params) {
if (params. password) {
params. password = authenticateService. encodePassword(params. password)
}
def user = new User(params)
if (user. validate()) {
if (params. captcha?.toUpperCase() != session. captcha) {
user. password = ""
flash. message = "Неправильный код"
return [user: user]
}
user = user. save()
Role role = Role. findById(rolesService. USER)
role. addToPeople(user)
role. save()
flash. message = "Вы успешно зарегистрировались"
redirect(uri: '/success')
} else {
user. password = ""
flash. message = "Ошибка регистрации"
return [user: user]
}
}
}
def showProfile = {
User user = User. get(params. id)
if (!user) {
response. sendError(HttpServletResponse. SC_NOT_FOUND); // 404
return
}
User myUser = authenticateService. userDomain() as User
int userRating = user?.profile?.rating?.value?: 0
userRating /= 1000000 / 100
List<Comment> comments = Comment. findAllByMaster(user, [offset: 0, max: 10])
[user: user, myUser: myUser, userRating: userRating]
}
def changeRole = {
List users = User. findAll()
List roles = Role. findAll()
[users: users, roles: roles]
}
def saveRole = {
def p = params
String role_id = params. role_id == "null" ? "" : params. role_id
if (role_id. isEmpty()) {
flash. error_message = "Роль #${params. role_id} отсутствует!"
redirect(action: "changeRole")
return
}
User user = User. get(params. user_id)
Role role = Role. get(params. role_id)
if (!user) {
flash. error_message = "Пользователь #${params. user_id} не найден!"
redirect(action: "changeRole")
return
}
if (!role) {
flash. error_message = "Роль #${params. role_id} отсутствует!"
redirect(action: "changeRole")
return
}
User myUser = authenticateService. userDomain() as User
if (user. id == myUser. id) {
flash. error_message = "Вы не можете изменить роль самому себе!"
redirect(action: "changeRole")
return
}
user. save()
Role. findAll().each { it. removeFromPeople(user) }
Role. findByAuthority(role. authority).addToPeople(user)
user = User. get(params. user_id)
if (!user. profile) {
UserRating _rating = new UserRating().save()
UserProfile prof = new UserProfile(aboutMe: "Новый пользователь", birthday: new Date(0, 0, 0),
name: "Новый", surname: "Пользователь", middle_name: "Очень", rating: _rating,
work: "Новый пользователь", state: "Здравствуйте!").save()
user. profile = prof
} else {
user. profile. editable = false
}
user. save()
ccess_message = "Роль пользователя #${user. id} успешно изменена на ${role. toString()}!"
redirect(action: "changeRole")
}
def test = {
ArrayList<String> keys = secureService. getGeneratedKeys(10, 10)
keys. clear()
}
}
Представления
<nav>
<table width="100%" align="center">
<tr>
<td><a href="<g:createLink action="index"/>">О проекте</a></td>
<td><a href="<g:createLink action="aboutInstitute"/>">Об институте</a></td>
<td><a class="active" href="<g:createLink action="aboutCathedra"/>">О кафедре</a></td>
<td><a href="<g:createLink controller="community" action="allComm"/>">Сообщества</a></td>
<td><a href="<g:createLink action="contacts"/>">Контакты</a></td>
</tr>
</table>
</nav>
<nav>
<table width="100%" align="center">
<tr>
<td><a href="<g:createLink controller="basic"/>">О проекте</a></td>
<td><a href="<g:createLink controller="basic" action="aboutInstitute"/>">Об институте</a></td>
<td><a href="<g:createLink controller="basic" action="aboutCathedra"/>">О кафедре</a></td>
<td><a class="active" href="<g:createLink controller="community" action="allComm"/>">Сообщества</a></td>
<td><a href="<g:createLink controller="basic" action="contacts"/>">Контакты</a></td>
</tr>
</table>
</nav>
<nav>
<table width="100%" align="center">
<tr>
<td><a href="<g:createLink action="index"/>">О проекте</a></td>
<td><a href="<g:createLink action="aboutInstitute"/>">Об институте</a></td>
<td><a href="<g:createLink action="aboutCathedra"/>">О кафедре</a></td>
<td><a href="<g:createLink controller="community" action="allComm"/>">Сообщества</a></td>
<td><a class="active" href="<g:createLink action="contacts"/>">Контакты</a></td>
</tr>
</table>
</nav>
<nav>
<table width="100%" align="center">
<tr>
<td><a href="<g:createLink action="index"/>">О проекте</a></td>
<td><a class="active" href="<g:createLink action="aboutInstitute"/>">Об институте</a>
</td>
<td><a href="<g:createLink action="aboutCathedra"/>">О кафедре</a></td>
<td><a href="<g:createLink controller="community" action="allComm"/>">Сообщества</a></td>
<td><a href="<g:createLink action="contacts"/>">Контакты</a></td>
</tr>
</table>
</nav>
<nav>
<table width="100%" align="center">
<tr>
<td><a href="<g:createLink controller="basic" action="index"/>">О проекте</a></td>
<td><a href="<g:createLink controller="basic" action="aboutInstitute"/>">Об институте</a></td>
<td><a href="<g:createLink controller="basic" action="aboutCathedra"/>">О кафедре</a></td>
<td><a href="<g:createLink controller="community" action="allComm"/>">Сообщества</a></td>
<td><a href="<g:createLink controller="basic" action="contacts"/>">Контакты</a></td>
</tr>
</table>
</nav>
<nav>
<table width="100%" align="center">
<tr>
<td><a class="active" href="<g:createLink action="index"/>">О проекте</a></td>
<td><a href="<g:createLink action="aboutInstitute"/>">Об институте</a></td>
<td><a href="<g:createLink action="aboutCathedra"/>">О кафедре</a></td>
<td><a href="<g:createLink controller="community" action="allComm"/>">Сообщества</a></td>
<td><a href="<g:createLink action="contacts"/>">Контакты</a></td>
</tr>
</table>
</nav>
<div id="registration"><b>Здравствуйте!</b><br>
<a href=""><g:img dir="images/soc" file="nophoto. png"/>
</a><g:fullName/><br>
<i><g:fullStatus/></i>
</div>
<div class="right_menu">
<g:ifAnyGranted role="ROLE_ADMIN">
<a href="${createLink(controller: "secret")}">Администраторская</a><br>
</g:ifAnyGranted>
<a href="">Моя страница</a><br>
<a href="">Мои сообщества</a><br>
<a href="">Редактировать профиль</a><br>
<a href="${createLink(controller: "logout")}">Выйти</a><br>
</div>
<div class="left_menu">
<ul>
<li><a href="">Моя страница</a></li>
<li><a href="">Мои сообщества</a></li>
<li><a href="${createLink(controller: "basic", action: "logout")}">Выйти</a></li>
</ul>
</div>
<div id="registration">
<g:if test='${flash. message}'>
<div class='login_message' style="color: #ff273d;">${flash. message}</div>
|
Из за большого объема этот материал размещен на нескольких страницах:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |


