conf.py 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/usr/bin/env python
  2. # Licensed to Cloudera, Inc. under one
  3. # or more contributor license agreements. See the NOTICE file
  4. # distributed with this work for additional information
  5. # regarding copyright ownership. Cloudera, Inc. licenses this file
  6. # to you under the Apache License, Version 2.0 (the
  7. # "License"); you may not use this file except in compliance
  8. # with the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. """
  18. Configuration options for the "user admin" application
  19. """
  20. from desktop.lib.conf import Config, ConfigSection, coerce_bool
  21. from django.utils.translation import ugettext_lazy as _
  22. HOME_DIR_PERMISSIONS = Config(
  23. key="home_dir_permissions",
  24. help=_("New user home directory is created with these permissions"),
  25. type=str,
  26. default="0755")
  27. DEFAULT_USER_GROUP = Config(
  28. key="default_user_group",
  29. help=_("The name of a default group for users at creation time, or at first login "
  30. "if the server is configured to authenticate against an external source."),
  31. type=str,
  32. default='default')
  33. PASSWORD_POLICY = ConfigSection(
  34. key="password_policy",
  35. help=_("Configuration options for user password policy"),
  36. members=dict(
  37. IS_ENABLED = Config(
  38. key="is_enabled",
  39. help=_("Enable user password policy."),
  40. type=coerce_bool,
  41. default=False),
  42. PWD_RULE = Config(
  43. key="pwd_regex",
  44. help=_("The regular expression of password rule. The default rule requires that "
  45. "a password must be at least 8 characters long, and must contain both "
  46. "uppercase and lowercase letters, at least one number, and at least one "
  47. "special character."),
  48. type=str,
  49. default="^(?=.*?[A-Z])(?=(.*[a-z]){1,})(?=(.*[\d]){1,})(?=(.*[\W_]){1,}).{8,}$"),
  50. PWD_HINT = Config(
  51. key="pwd_hint",
  52. help=_("Message about the password rule defined in pwd_regex"),
  53. type=str,
  54. default="The password must be at least 8 characters long, and must contain both " + \
  55. "uppercase and lowercase letters, at least one number, and at least " + \
  56. "one special character."),
  57. PWD_ERROR_MESSAGE = Config(
  58. key="pwd_error_message",
  59. help=_("The error message displayed if the provided password does not "
  60. "meet the enhanced password rule"),
  61. type=str,
  62. default="The password must be at least 8 characters long, and must contain both " + \
  63. "uppercase and lowercase letters, at least one number, and at least " + \
  64. "one special character.")
  65. )
  66. )