UserAction Klassenreferenz

Klassendiagramm für UserAction:

Inheritance graph
base refererrect $classAction.html 6,7 190,463

Aufstellung aller Elemente

Öffentliche Methoden

 UserAction ()
 save ()
 remove ()
 delete ()
 add ()
 adduser ()
 addgrouptouser ()
 addgroup ()
 delgroup ()
 mailPw ($pw)
 pwchange ()
 listing ()
 edit ()
 memberships ()
 groups ()
 savegroups ()
 pw ()
 rights ()
 checkMenu ($menu)

Öffentliche Attribute

 $user
 $defaultSubAction = 'edit'


Ausführliche Beschreibung

Definiert in Zeile 29 der Datei UserAction.class.php.


Dokumentation der Elementfunktionen

UserAction::add (  ) 

Definiert in Zeile 101 der Datei UserAction.class.php.

00102      {
00103      }

UserAction::addgroup (  ) 

Definiert in Zeile 131 der Datei UserAction.class.php.

Benutzt Action::setTemplateVar().

00132      {
00133           // Alle hinzufuegbaren Gruppen ermitteln
00134           $this->setTemplateVar('groups',$this->user->getOtherGroups());
00135      }

UserAction::addgrouptouser (  ) 

Definiert in Zeile 123 der Datei UserAction.class.php.

Benutzt Action::addNotice() und Action::getRequestVar().

00124      {
00125           $this->user->addGroup( $this->getRequestVar('groupid') );
00126      
00127           $this->addNotice('user',$this->user->name,'ADDED','ok');
00128      }

UserAction::adduser (  ) 

Definiert in Zeile 107 der Datei UserAction.class.php.

Benutzt Action::addNotice(), Action::addValidationError(), Action::callSubAction() und Action::getRequestVar().

00108      {
00109           if   ( $this->getRequestVar('name') != '' )
00110           {
00111                $this->user = new User();
00112                $this->user->add( $this->getRequestVar('name') );
00113                $this->addNotice('user',$this->user->name,'ADDED','ok');
00114           }
00115           else
00116           {
00117                $this->addValidationError('name');
00118                $this->callSubAction('add');
00119           }
00120      }

UserAction::checkMenu ( menu  ) 

Parameter:
String $name Men�punkt
Rückgabe:
boolean

Erneute Implementation von Action.

Definiert in Zeile 384 der Datei UserAction.class.php.

Benutzt $conf.

00385      {
00386           global $conf;
00387 
00388           switch( $menu )
00389           {
00390                case 'addgroup':
00391                     return count($this->user->getOtherGroups()) > 0;
00392 
00393                case 'groups':
00394                     return count($this->user->getGroups()) > 0;
00395      
00396                case 'pw':
00397                     return     @$conf['security']['auth']['type'] == 'database'
00398                            && !@$conf['security']['auth']['userdn'];
00399           }
00400           
00401           return true;
00402      }

UserAction::delete (  ) 

Definiert in Zeile 86 der Datei UserAction.class.php.

Benutzt Action::addNotice(), Action::addValidationError(), Action::callSubAction() und Action::hasRequestVar().

00087      {
00088           if   ( $this->hasRequestVar('confirm') )
00089           {
00090                $this->user->delete();
00091                $this->addNotice('user',$this->user->name,'DELETED','ok');
00092           }
00093           else
00094           {
00095                $this->addValidationError('confirm');
00096                $this->callSubAction('remove');
00097           }
00098      }

UserAction::delgroup (  ) 

Definiert in Zeile 138 der Datei UserAction.class.php.

Benutzt Action::addNotice() und Action::getRequestVar().

00139      {
00140           $this->user->delGroup( $this->getRequestVar('groupid') );
00141 
00142           $this->addNotice('user',$this->user->name,'DELETED','ok');
00143      }

UserAction::edit (  ) 

Eigenschaften des Benutzers anzeigen

Definiert in Zeile 227 der Datei UserAction.class.php.

Benutzt Action::setTemplateVar() und Action::setTemplateVars().

00228      {
00229           $this->setTemplateVars( $this->user->getProperties() );
00230 
00231           $this->setTemplateVar( 'allstyles',$this->user->getAvailableStyles() );
00232      }

UserAction::groups (  ) 

Definiert in Zeile 241 der Datei UserAction.class.php.

Benutzt $conf, Action::addNotice(), Group::getAll() und Action::setTemplateVar().

00242      {
00243           // Mitgliedschaften
00244 //        $this->setTemplateVar('memberships',$this->user->getGroups());
00245           
00246           $gruppenListe = array();
00247           
00248           $allGroups  = Group::getAll();
00249           $userGroups = $this->user->getGroups();
00250           
00251           foreach( $allGroups as $id=>$name )
00252           {
00253                
00254                $hasGroup = array_key_exists($id,$userGroups);
00255                $varName  = 'group'.$id;
00256                $gruppenListe[$id] = array('name'       =>$name,
00257                                           'id'         =>$id,
00258                                           'var'        =>$varName,
00259                                           'member'     =>$hasGroup
00260                                          );
00261                $this->setTemplateVar($varName,$hasGroup);
00262           }
00263           $this->setTemplateVar('memberships',$gruppenListe);
00264           
00265           global $conf;
00266           if   ($conf['security']['authorize']['type']=='ldap')
00267                $this->addNotice('user',$this->user->name,'GROUPS_MAY_CONFLICT_WITH_LDAP',OR_NOTICE_WARN);
00268      }

UserAction::listing (  ) 

Definiert in Zeile 210 der Datei UserAction.class.php.

Benutzt $user, User::getAllUsers(), Action::setTemplateVar() und Html::url().

00211      {
00212           $list = array();
00213 
00214           foreach( User::getAllUsers() as $user )
00215           {
00216                $list[$user->userid]         = $user->getProperties();
00217                $list[$user->userid]['url' ] = Html::url('main','user',$user->userid,
00218                                                         array(REQ_PARAM_TARGETSUBACTION=>'edit') );
00219           }
00220           $this->setTemplateVar('el',$list);
00221      }    

UserAction::mailPw ( pw  ) 

Das Kennwort wird an den Benutzer geschickt

private

Definiert in Zeile 151 der Datei UserAction.class.php.

Wird benutzt von pwchange().

00152      {
00153           $to   = $this->user->fullname.' <'.$this->user->mail.'>';
00154           $mail = new Mail($to,'USER_MAIL');
00155 
00156           $mail->setVar('username',$this->user->name      );
00157           $mail->setVar('password',$pw                    );
00158           $mail->setVar('name'    ,$this->user->getName() );
00159 
00160           $mail->send();
00161      }

UserAction::memberships (  ) 

Definiert in Zeile 235 der Datei UserAction.class.php.

00236      {
00237           
00238      }

UserAction::pw (  ) 

Aendern des Kennwortes

Definiert in Zeile 298 der Datei UserAction.class.php.

Benutzt Action::setTemplateVars().

00299      {
00300           $this->setTemplateVars( $this->user->getProperties() );
00301      }

UserAction::pwchange (  ) 

Aendern des Kennwortes

Definiert in Zeile 167 der Datei UserAction.class.php.

Benutzt $conf, Action::addNotice(), Action::addValidationError(), Action::callSubAction(), Action::getRequestVar(), Action::hasRequestVar() und mailPw().

00168      {
00169           global $conf;
00170 
00171           $pw1 = $this->getRequestVar('password1');
00172           $pw2 = $this->getRequestVar('password2');
00173 
00174           // Zufaelliges Kennwort erzeugen
00175           if   ( $this->hasRequestVar('random') && $this->hasRequestVar('email') )
00176           {
00177                $pw1 = $this->user->createPassword();
00178                $pw2 = $pw1;
00179           }
00180 
00181           if ( strlen($pw1)<intval($conf['security']['password']['min_length']) )
00182           {
00183                $this->addValidationError('password1');
00184                $this->callSubAction('pw');
00185           }
00186           elseif    ( $pw1 != $pw2 )
00187           {
00188                $this->addValidationError('password2');
00189                $this->callSubAction('pw');
00190           }
00191           else
00192           {
00193                // Kennwoerter identisch und lang genug
00194                $this->user->setPassword($pw1,!$this->hasRequestVar('timeout') ); // Kennwort setzen
00195                
00196                // E-Mail mit dem neuen Kennwort an Benutzer senden
00197                if   ( $this->hasRequestVar('email') && !empty($this->user->mail) && $conf['mail']['enabled'] )
00198                {
00199                     $this->mailPw( $pw1 );
00200                     $this->addNotice('user',$this->user->name,'MAIL_SENT','ok');
00201                }
00202 
00203                $this->addNotice('user',$this->user->name,'SAVED','ok');
00204           }
00205 
00206      }

UserAction::remove (  ) 

Definiert in Zeile 79 der Datei UserAction.class.php.

Benutzt Action::setTemplateVars().

00080      {
00081           $this->setTemplateVars( $this->user->getProperties() );
00082      }

UserAction::rights (  ) 

Anzeigen der Benutzerrechte

Definiert in Zeile 307 der Datei UserAction.class.php.

Benutzt $user, Action::addNotice(), Acl::getAvailableRights(), lang() und Action::setTemplateVar().

00308      {
00309           $rights = $this->user->getAllAcls();
00310 
00311           $projects = array();
00312           
00313           foreach( $rights as $acl )
00314           {
00315                if   ( !isset($projects[$acl->projectid]))
00316                {
00317                     $projects[$acl->projectid] = array();
00318                     $p = new Project($acl->projectid);
00319                     $p->load();
00320                     $projects[$acl->projectid]['projectname'] = $p->name;
00321                     $projects[$acl->projectid]['rights'     ] = array();
00322                }
00323 
00324                $right = array();
00325                
00326                if   ( $acl->languageid > 0 )
00327                {
00328                     $language = new Language($acl->languageid);
00329                     $language->load();
00330                     $right['languagename'] = $language->name;
00331                }
00332                else
00333                {
00334                     $right['languagename'] = lang('ALL_LANGUAGES');
00335                }
00336                
00337                
00338                $o = new Object($acl->objectid);
00339                $o->objectLoad();
00340                $right['objectname'] = $o->name;
00341                $right['objectid'  ] = $o->objectid;
00342                $right['objecttype'] = $o->getType();
00343                
00344                if   ( $acl->userid > 0 )
00345                {
00346                     $user = new User($acl->userid);
00347                     $user->load();
00348                     $right['username'] = $user->name;
00349                }
00350                elseif    ( $acl->groupid > 0 )
00351                {
00352                     $group = new Group($acl->groupid);
00353                     $group->load();
00354                     $right['groupname'] = $group->name;
00355                }
00356                else
00357                {
00358                     // Berechtigung f�r "alle".
00359                }
00360 
00361 //             $show = array();
00362 //             foreach( $acl->getProperties() as $p=>$set)
00363 //                  $show[$p] = $set;
00364 //                  
00365 //             $right['show'] = $show;
00366                $right['bits'] = $acl->getProperties();
00367                
00368                $projects[$acl->projectid]['rights'][] = $right;
00369           }
00370           
00371           $this->setTemplateVar('projects'    ,$projects );
00372           
00373           $this->setTemplateVar('show',Acl::getAvailableRights() );
00374           
00375           if   ( $this->user->isAdmin )
00376                $this->addNotice('user',$this->user->name,'ADMIN_NEEDS_NO_RIGHTS',OR_NOTICE_WARN);
00377      }

UserAction::save (  ) 

Definiert in Zeile 49 der Datei UserAction.class.php.

Benutzt $conf, Action::addNotice(), Action::addValidationError(), Action::callSubAction(), Action::getRequestVar() und Action::hasRequestVar().

00050      {
00051           if   ( $this->getRequestVar('name') != '' )
00052           {
00053                // Benutzer speichern
00054                $this->user->name     = $this->getRequestVar('name'    );
00055                $this->user->fullname = $this->getRequestVar('fullname');
00056                $this->user->isAdmin  = $this->hasRequestVar('is_admin');
00057                $this->user->ldap_dn  = $this->getRequestVar('ldap_dn' );
00058                $this->user->tel      = $this->getRequestVar('tel'     );
00059                $this->user->desc     = $this->getRequestVar('desc'    );
00060                
00061                global $conf;
00062                if   ( @$conf['security']['user']['show_mail'] )
00063                     $this->user->mail = $this->getRequestVar('mail'    );
00064                     
00065                $this->user->style    = $this->getRequestVar('style'   );
00066      
00067                $this->user->save();
00068                $this->addNotice('user',$this->user->name,'SAVED','ok');
00069           }
00070           else
00071           {
00072                $this->addValidationError('name');
00073                $this->callSubAction('edit');
00074           }
00075      }

UserAction::savegroups (  ) 

Definiert in Zeile 271 der Datei UserAction.class.php.

Benutzt Action::addNotice(), Group::getAll() und Action::hasRequestVar().

00272      {
00273           $allGroups  = Group::getAll();
00274           $userGroups = $this->user->getGroups();
00275           
00276           foreach( $allGroups as $id=>$name )
00277           {
00278                $hasGroup = array_key_exists($id,$userGroups);
00279                
00280                if   ( !$hasGroup && $this->hasRequestVar('group'.$id) )
00281                {
00282                     $this->user->addGroup($id);
00283                     $this->addNotice('group',$name,'ADDED');
00284                }
00285 
00286                if   ( $hasGroup && !$this->hasRequestVar('group'.$id) )
00287                {
00288                     $this->user->delGroup($id);
00289                     $this->addNotice('group',$name,'DELETED');
00290                }
00291           }
00292      }

UserAction::UserAction (  ) 

Definiert in Zeile 35 der Datei UserAction.class.php.

Benutzt Action::getRequestId(), Action::setTemplateVar() und Action::userIsAdmin().

00036      {
00037           if   ( !$this->userIsAdmin() )
00038                die('you are not an admin');
00039 
00040           if   ( $this->getRequestId() != 0 )
00041           {
00042                $this->user = new User( $this->getRequestId() );
00043                $this->user->load();
00044                $this->setTemplateVar('userid',$this->user->userid);
00045           }
00046      }


Dokumentation der Datenelemente

UserAction::$defaultSubAction = 'edit'

Definiert in Zeile 32 der Datei UserAction.class.php.

UserAction::$user

Definiert in Zeile 31 der Datei UserAction.class.php.

Wird benutzt von listing() und rights().


Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei:

Erzeugt am Thu May 14 00:55:51 2009 für OpenRat von  doxygen 1.5.8