@Persistent
private Date lastAccess;
+ /**
+ * 管理者権限を持つかどうか
+ */
+ @Persistent
+ private boolean isAdmin;
+
public Long getAccountId() {
return this.accountId;
}
public void setEmail(String email) {
this.email = email;
}
+
+ /**
+ * @return the isAdmin
+ */
+ public boolean isAdmin() {
+ return this.isAdmin;
+ }
+
+ /**
+ * @param isAdmin
+ * the isAdmin to set
+ */
+ public void setAdmin(boolean isAdmin) {
+ this.isAdmin = isAdmin;
+ }
}
import jp.sourceforge.rabbitBTS.exceptions.RabbitBTSException;
import jp.sourceforge.rabbitBTS.models.Account;
-import org.springframework.stereotype.Service;
-
import com.google.appengine.api.users.User;
/**
*
* @author senju
*/
-@Service()
public class AccountService {
/**
+ * システムに最初管理者として登録されるユーザーのアドレス
+ */
+ private String firstSuperUser;
+
+ /**
* 現在ログイン中のgoogleアカウントのアカウントを取得する。
*
* @return 取得したアカウント。ログインしていない場合はnull
// OK
}
+ // 最初のスーパーユーザーかチェック
+ if (account.getEmail().equals(this.firstSuperUser)) {
+ account.setAdmin(true);
+ Sht.log(this).warning(
+ "Admin Account Created. " + this.firstSuperUser);
+ }
+
// 登録処理
account.setLastAccess(new Date());
pm.makePersistent(account);
}
}
}
+
+ /**
+ * @return the firstSuperUser
+ */
+ public String getFirstSuperUser() {
+ return this.firstSuperUser;
+ }
+
+ /**
+ * @param firstSuperUser
+ * the firstSuperUser to set
+ */
+ public void setFirstSuperUser(String firstSuperUser) {
+ this.firstSuperUser = firstSuperUser;
+ }
}
class="org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator"
/> <bean class="jp.sourceforge.rabbitBTS.TestAspect" />
-->
+
+ <bean class="jp.sourceforge.rabbitBTS.services.AccountService">
+ <property name="firstSuperUser" value="test@example.com" />
+ </bean>
+
<!-- validator -->
<bean id="configurationLoader"
class="org.springmodules.validation.bean.conf.loader.annotation.AnnotationBeanValidationConfigurationLoader" />