Logo Search packages:      
Sourcecode: samba-gtk version File versions  Download package

def sambagtk::pygwsam::SAMPipeManager::update_user_security (   self,
  user_handle,
  user 
)
Updates the access mask for 'user'.

returns nothing

Definition at line 207 of file pygwsam.py.

                                                     :
        """Updates the access mask for 'user'.
        
        returns nothing"""
        secinfo = self.pipe.QuerySecurity(user_handle, security.SECINFO_DACL)
        sid = str(self.pipe.RidToSid(self.domain_handle, user.rid))
        
        #this is for readability, we could just do secinfo.sd.dacl.aces[i].trustee if we wanted
        security_descriptor = secinfo.sd
        DACL = security_descriptor.dacl
        ace_list = DACL.aces
        
        ace = None
            
        for item in ace_list:
            if str(item.trustee) == sid:
                ace = item
                break
            
        if ace == None:
            print "unable to fetch security info for", user.username, "because none exists."
            return user
        
        if user.cannot_change_password:
            ace_list[0].access_mask &= ~samr.SAMR_USER_ACCESS_CHANGE_PASSWORD
            ace.access_mask &= ~samr.SAMR_USER_ACCESS_CHANGE_PASSWORD
        else:
            ace_list[0].access_mask |= samr.SAMR_USER_ACCESS_CHANGE_PASSWORD
            ace.access_mask |= samr.SAMR_USER_ACCESS_CHANGE_PASSWORD
            
        self.pipe.SetSecurity(user_handle, security.SECINFO_DACL, secinfo)
        return


Generated by  Doxygen 1.6.0   Back to index