OSDN Git Service

add ACS webapp, sql, htdocs
[acs/acs.git] / webapp / modules / User / actions / ChangePasswordAction.class.php
diff --git a/webapp/modules/User/actions/ChangePasswordAction.class.php b/webapp/modules/User/actions/ChangePasswordAction.class.php
new file mode 100644 (file)
index 0000000..28f4ccc
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+// $Id: ChangePasswordAction.class.php,v 1.3 2006/03/28 07:55:34 kuwayama Exp $
+
+class ChangePasswordAction extends BaseAction
+{
+       // GET
+       function getDefaultView() {
+               $context = $this->getContext();
+               $controller = $context->getController();
+               $request =  $context->getRequest();
+               $user = $context->getUser();
+               $acs_user_info_row = $user->getAttribute('acs_user_info_row');
+       
+               if (!$this->get_execute_privilege()) {
+                       $controller->forward(SECURE_MODULE, SECURE_ACTION);
+                       return;
+               }
+               return View::INPUT;
+       }
+
+       // POST
+       function execute() {
+               $context = $this->getContext();
+               $controller = $context->getController();
+               $request =  $context->getRequest();
+               $user = $context->getUser();
+               $acs_user_info_row = $user->getAttribute('acs_user_info_row');
+
+               $form = $request->ACSGetParameters();
+
+               // ¥Ñ¥¹¥ï¡¼¥É¤òÊѹ¹¤¹¤ë
+               if($form['passwd'] != '' && $form['passwd'] == $form['passwd2']) {
+                       ACSSystem::update_passwd($acs_user_info_row['user_id'], $form['passwd']);
+               }
+
+               $user_list_url = $this->getControllerPath('User', 'Index');
+               header("Location: $user_list_url");
+       }
+
+       function getRequestMethods() {
+               return Request::POST;
+       }
+
+       function isSecure () {
+               return false;
+       }
+
+       function get_execute_privilege () {
+               $context = $this->getContext();
+               $user = $context->getUser();
+
+               // Ëܿͤǡ¢LDAPǧ¾Ú°Ê³°¤Î¾ì¹ç¤ÏOK
+               if ($user->hasCredential('USER_PAGE_OWNER') 
+                               && $user->hasCredential('NOT_LDAP_USER')) {
+                       return true;
+               }
+               return false;
+       }
+}
+
+?>