class NFS_Share(Model): nfs_comment = models.CharField( max_length=120, verbose_name=_("Comment"), blank=True, ) nfs_network = models.TextField( verbose_name=_("Authorized networks"), help_text=_( "Networks that are authorized to access the NFS share." " Specify network numbers of the form 1.2.3.4/xx where xx is " "the number of bits of netmask."), blank=True, ) nfs_hosts = models.TextField( verbose_name=_("Authorized IP addresses or hosts"), help_text=_("IP addresses or hostnames that are authorized to " "access the NFS share."), blank=True, ) nfs_alldirs = models.BooleanField( verbose_name=_("All Directories"), help_text= _("Allow mounting of any subdirectory under this mount point if selected. Otherwise, only the top level directory can be mounted." ), ) nfs_ro = models.BooleanField( verbose_name=_("Read Only"), help_text=_("Export the share read only. Writes are not permitted.")) nfs_quiet = models.BooleanField( verbose_name=_("Quiet"), help_text= _("Inhibit syslog warnings if there are problems with exporting this share." )) nfs_maproot_user = UserField( verbose_name=_("Maproot User"), max_length=120, blank=True, null=True, default='', help_text=_("If a user is selected, the root user is limited to " "that user's permissions")) nfs_maproot_group = GroupField( verbose_name=_("Maproot Group"), max_length=120, blank=True, null=True, default='', help_text=_("If a group is selected, the root user will also be " "limited to that group's permissions")) nfs_mapall_user = UserField( verbose_name=_("Mapall User"), max_length=120, blank=True, null=True, default='', help_text=_("The specified user's permissions are used by all " "clients")) nfs_mapall_group = GroupField( verbose_name=_("Mapall Group"), max_length=120, blank=True, null=True, default='', help_text=_("The specified group's permission are used by all " "clients")) def __unicode__(self): if self.nfs_comment: return unicode(self.nfs_comment) return u"[%s]" % ', '.join([p.path for p in self.paths.all()]) def delete(self, *args, **kwargs): super(NFS_Share, self).delete(*args, **kwargs) notifier().reload("nfs") @property def nfs_paths(self): return u"%s" % ', '.join([p.path for p in self.paths.all()]) class Meta: verbose_name = _("Unix (NFS) Share") verbose_name_plural = _("Unix (NFS) Shares")
class NFS_Share(Model): nfs_comment = models.CharField( max_length=120, verbose_name=_("Comment"), blank=True, ) nfs_network = models.TextField( verbose_name=_("Authorized networks"), help_text=_( "Networks that are authorized to access the NFS share." " Specify network numbers of the form 1.2.3.4/xx where xx is " "the number of bits of netmask."), blank=True, ) nfs_hosts = models.TextField( verbose_name=_("Authorized IP addresses or hosts"), help_text=_("IP addresses or hostnames that are authorized to " "access the NFS share."), blank=True, ) nfs_alldirs = models.BooleanField( verbose_name=_('All Directories'), help_text=_( 'Allow mounting of any subdirectory under this mount point if' 'selected. Otherwise, only the top level directory can be mounted.' ), default=False, ) nfs_ro = models.BooleanField( verbose_name=_('Read Only'), help_text=_('Export the share read only. Writes are not permitted.'), default=False, ) nfs_quiet = models.BooleanField( verbose_name=_('Quiet'), help_text=_( 'Inhibit syslog warnings if there are problems with exporting ' 'this share.'), default=False, ) nfs_maproot_user = UserField( verbose_name=_("Maproot User"), max_length=120, blank=True, null=True, default='', help_text=_( "The credentials of the specified user is used for remote access " "by root."), ) nfs_maproot_group = GroupField( verbose_name=_("Maproot Group"), max_length=120, blank=True, null=True, default='', help_text=_( "The credentials of the specified group is used for remote access " "by root."), ) nfs_mapall_user = UserField( verbose_name=_("Mapall User"), max_length=120, blank=True, null=True, default='', help_text=_( "The credentials of the specified user is used for remote access " "by all users."), ) nfs_mapall_group = GroupField( verbose_name=_("Mapall Group"), max_length=120, blank=True, null=True, default='', help_text=_( "The credentials of the specified group is used for remote access " "by all users."), ) nfs_security = MultiSelectField( verbose_name=_('Security'), max_length=200, blank=True, choices=( ('sys', 'sys'), ('krb5', 'krb5'), ('krb5i', 'krb5i'), ('krb5p', 'krb5p'), ), ) def __str__(self): if self.nfs_comment: return str(self.nfs_comment) return "[%s]" % ', '.join([p.path for p in self.paths.all()]) def delete(self, *args, **kwargs): super(NFS_Share, self).delete(*args, **kwargs) notifier().reload("nfs") @property def nfs_paths(self): return [p.path for p in self.paths.all()] class Meta: verbose_name = _("Unix (NFS) Share") verbose_name_plural = _("Unix (NFS) Shares")