Subversion Repositories php_users

Rev

Rev 20 | Rev 33 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 20 Rev 21
Line 39... Line 39...
39
 * UsersPermissions extends the Users class to include boolean
39
 * UsersPermissions extends the Users class to include boolean
40
 * permissions.
40
 * permissions.
41
 * 
41
 * 
42
 * @author R. W. Rodolico <rodo@unixservertech.com>
42
 * @author R. W. Rodolico <rodo@unixservertech.com>
43
 * 
43
 * 
44
 * @version 0.9.0 (beta)
44
 * @version 1.0.0 (beta)
45
 * @copyright 2021 Daily Data, Inc.
45
 * @copyright 2021 Daily Data, Inc.
46
 * 
46
 * 
47
 */
47
 */
48
 
48
 
49
class UsersPermissions extends Users {
49
class UsersPermissions extends Users {
Line 131... Line 131...
131
   protected function addEdit( $connection ) {
131
   protected function addEdit( $connection ) {
132
      $return = parent::addEdit( $connection );
132
      $return = parent::addEdit( $connection );
133
      $data = array();
133
      $data = array();
134
      // now we process all of the permissions
134
      // now we process all of the permissions
135
      if ( $return != 'Error' ) {
135
      if ( $return != 'Error' ) {
-
 
136
         if ( $this->workingOn['id'] == -1 ) {
-
 
137
            $newUserID = $connection->getUserID( $_REQUEST['admin_login'] );
-
 
138
         }
136
         foreach ( $this->workingOn['permissions'] as $name => $value ) {
139
         foreach ( $this->workingOn['permissions'] as $name => $value ) {
137
            $htmlFieldName = $this->configuration['input prefix'] . $name;
140
            $htmlFieldName = $this->configuration['input prefix'] . $name;
138
            // if a new user, the permission is whatever is in the form
141
            // if a new user, the permission is whatever is in the form
139
            if ( $this->workingOn['id'] == -1 && isset( $_REQUEST[$htmlFieldName] ) ) {
142
            if ( $this->workingOn['id'] == -1 && isset( $_REQUEST[$htmlFieldName] ) ) {
140
               $data[$name] = 1;
143
               $data[$name] = 1;
141
            // otherwise, if it is not a new user, only do an update if it has changed
144
            // otherwise, if it is not a new user, only do an update if it has changed
142
            } elseif ( $this->workingOn['id'] > 0 && isset( $_REQUEST[$htmlFieldName] ) != $this->workingOn['permissions'][$name] ) {
145
            } elseif ( $this->workingOn['id'] > 0 && isset( $_REQUEST[$htmlFieldName] ) != $this->workingOn['permissions'][$name] ) {
143
               $data[$name] = isset( $_REQUEST[$htmlFieldName] ) ? 1 : 0;
146
               $data[$name] = isset( $_REQUEST[$htmlFieldName] ) ? 1 : 0;
144
            }
147
            }
145
         } // foreach
148
         } // foreach
146
         $connection->updatePermissions( $this->workingOn['id'],$data );
149
         $connection->updatePermissions( ($this->workingOn['id'] == -1 ? $newUserID : $this->workingOn['id'] ),$data );
147
      } // if not an error
150
      } // if not an error
148
      return $return;
151
      return $return;
149
   } // addEdit
152
   } // addEdit
150
   
153
   
151
   /**
154
   /**