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