##// END OF EJS Templates
docs: add change user details docs
marcink -
r925:b469a885 default
parent child Browse files
Show More
@@ -1,95 +1,119 b''
1 1 .. _rhodecode-reset-ref:
2 2
3 3 Settings Management
4 4 -------------------
5 5
6 6 All |RCE| settings can be set from the user interface, but in the event that
7 7 it somehow becomes unavailable you can use ``ishell`` inside your |RCE|
8 8 ``virtualenv`` to carry out emergency measures.
9 9
10 10 .. warning::
11 11
12 12 Logging into the |RCE| database with ``iShell`` should only be done by an
13 13 experienced and knowledgeable database administrator.
14 14
15 15 Reset Admin Account Privileges
16 16 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17 17
18 18 If you accidentally remove your admin privileges from the admin account you
19 19 can restore them using ``ishell``. Use the following example to reset your
20 20 account permissions.
21 21
22 22 .. code-block:: bash
23 23
24 24 # Open iShell from the terminal
25 $ .rccontrol/enterprise-5/profile/bin/paster \
26 ishell .rccontrol/enterprise-5/rhodecode.ini
25 $ .rccontrol/enterprise-1/profile/bin/paster \
26 ishell .rccontrol/enterprise-1/rhodecode.ini
27 27
28 28 .. code-block:: mysql
29 29
30 30 # Use this example to change user permissions
31 31 In [1]: adminuser = User.get_by_username('username')
32 32 In [2]: adminuser.admin = True
33 33 In [3]: Session().add(adminuser);Session().commit()
34 34 In [4]: exit()
35 35
36 36 Set to read global ``.hgrc`` file
37 37 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38 38
39 39 By default, |RCE| does not read global ``hgrc`` files in
40 40 ``/etc/mercurial/hgrc`` or ``/etc/mercurial/hgrc.d`` because it
41 41 can lead to issues. This is set in the ``rhodecode_ui`` table for which
42 42 there is no UI. If you need to edit this you can
43 43 manually change the settings using SQL statements with ``ishell``. Use the
44 44 following example to make changes to this table.
45 45
46 46 .. code-block:: bash
47 47
48 48 # Open iShell from the terminal
49 49 $ .rccontrol/enterprise-5/profile/bin/paster \
50 50 ishell.rccontrol/enterprise-5/rhodecode.ini
51 51
52 52 .. code-block:: mysql
53 53
54 54 # Use this example to enable global .hgrc access
55 In [4]: new_option = RhodeCodeUi()
56 In [5]: new_option.ui_section='web'
57 In [6]: new_option.ui_key='allow_push'
58 In [7]: new_option.ui_value='*'
59 In [8]: Session().add(new_option);Session().commit()
55 In [1]: new_option = RhodeCodeUi()
56 In [2]: new_option.ui_section='web'
57 In [3]: new_option.ui_key='allow_push'
58 In [4]: new_option.ui_value='*'
59 In [5]: Session().add(new_option);Session().commit()
60 In [6]: exit()
60 61
61 62 Manually Reset Password
62 63 ^^^^^^^^^^^^^^^^^^^^^^^
63 64
64 65 If you need to manually reset a user password, use the following steps.
65 66
66 67 1. Navigate to your |RCE| install location.
67 68 2. Run the interactive ``ishell`` prompt.
68 69 3. Set a new password.
69 70
70 71 Use the following code example to carry out these steps.
71 72
72 73 .. code-block:: bash
73 74
74 75 # starts the ishell interactive prompt
75 $ .rccontrol/enterprise-5/profile/bin/paster \
76 ishell .rccontrol/enterprise-5/rhodecode.ini
76 $ .rccontrol/enterprise-1/profile/bin/paster \
77 ishell .rccontrol/enterprise-1/rhodecode.ini
77 78
78 79 .. code-block:: mysql
79 80
80 from rhodecode.lib.auth import generate_auth_token
81 from rhodecode.lib.auth import get_crypt_password
82
81 In [1]: from rhodecode.lib.auth import generate_auth_token
82 In [2]: from rhodecode.lib.auth import get_crypt_password
83 83 # Enter the user name whose password you wish to change
84 my_user = 'USERNAME'
85 u = User.get_by_username(my_user)
86
84 In [3]: my_user = 'USERNAME'
85 In [4]: u = User.get_by_username(my_user)
87 86 # If this fails then the user does not exist
88 u.auth_token = generate_auth_token(my_user)
89
87 In [5]: u.auth_token = generate_auth_token(my_user)
90 88 # Set the new password
91 u.password = get_crypt_password('PASSWORD')
89 In [6]: u.password = get_crypt_password('PASSWORD')
90 In [7]: Session().add(u);Session().commit()
91 In [8]: exit()
92
93
94
95 Change user details
96 ^^^^^^^^^^^^^^^^^^^
97
98 If you need to manually change some of users details, use the following steps.
99
100 1. Navigate to your |RCE| install location.
101 2. Run the interactive ``ishell`` prompt.
102 3. Set a new arguments for users.
92 103
93 Session().add(u)
94 Session().commit()
95 exit
104 Use the following code example to carry out these steps.
105
106 .. code-block:: bash
107
108 # starts the ishell interactive prompt
109 $ .rccontrol/enterprise-1/profile/bin/paster \
110 ishell .rccontrol/enterprise-1/rhodecode.ini
111
112 .. code-block:: mysql
113
114 # Use this example to change email and username of LDAP user
115 In [1]: my_user = User.get_by_username('some_username')
116 In [2]: my_user.email = 'new_email@foobar.com'
117 In [3]: my_user.username = 'SomeUser'
118 In [4]: Session().add(my_user);Session().commit()
119 In [5]: exit()
General Comments 0
You need to be logged in to leave comments. Login now