##// 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 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 16 Reset Admin Account Privileges
16 17 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17 18
18 19 If you accidentally remove your admin privileges from the admin account you
19 20 can restore them using ``ishell``. Use the following example to reset your
20 21 account permissions.
21 22
22 23 .. code-block:: bash
23 24
24 25 # Open iShell from the terminal
25 26 $ rccontrol ishell enterprise-1
26 27
27 28 .. code-block:: mysql
28 29
29 30 # Use this example to change user permissions
30 31 In [1]: adminuser = User.get_by_username('username')
31 32 In [2]: adminuser.admin = True
32 33 In [3]: Session().add(adminuser);Session().commit()
33 34 In [4]: exit()
34 35
36
35 37 Set to read global ``.hgrc`` file
36 38 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
37 39
38 40 By default, |RCE| does not read global ``hgrc`` files in
39 41 ``/etc/mercurial/hgrc`` or ``/etc/mercurial/hgrc.d`` because it
40 42 can lead to issues. This is set in the ``rhodecode_ui`` table for which
41 43 there is no UI. If you need to edit this you can
42 44 manually change the settings using SQL statements with ``ishell``. Use the
43 45 following example to make changes to this table.
44 46
45 47 .. code-block:: bash
46 48
47 49 # Open iShell from the terminal
48 50 $ rccontrol ishell enterprise-1
49 51
50 52 .. code-block:: mysql
51 53
52 54 # Use this example to enable global .hgrc access
53 55 In [1]: new_option = RhodeCodeUi()
54 56 In [2]: new_option.ui_section='web'
55 57 In [3]: new_option.ui_key='allow_push'
56 58 In [4]: new_option.ui_value='*'
57 59 In [5]: Session().add(new_option);Session().commit()
58 60 In [6]: exit()
59 61
62
60 63 Manually Reset Password
61 64 ^^^^^^^^^^^^^^^^^^^^^^^
62 65
63 66 If you need to manually reset a user password, use the following steps.
64 67
65 68 1. Navigate to your |RCE| install location.
66 69 2. Run the interactive ``ishell`` prompt.
67 70 3. Set a new password.
68 71
69 72 Use the following code example to carry out these steps.
70 73
71 74 .. code-block:: bash
72 75
73 76 # starts the ishell interactive prompt
74 77 $ rccontrol ishell enterprise-1
75 78
76 79 .. code-block:: mysql
77 80
78 81 In [1]: from rhodecode.lib.auth import generate_auth_token
79 82 In [2]: from rhodecode.lib.auth import get_crypt_password
80 83 # Enter the user name whose password you wish to change
81 84 In [3]: my_user = 'USERNAME'
82 85 In [4]: u = User.get_by_username(my_user)
83 86 # If this fails then the user does not exist
84 87 In [5]: u.auth_token = generate_auth_token(my_user)
85 88 # Set the new password
86 89 In [6]: u.password = get_crypt_password('PASSWORD')
87 90 In [7]: Session().add(u);Session().commit()
88 91 In [8]: exit()
89 92
90 93
91
92 94 Change user details
93 95 ^^^^^^^^^^^^^^^^^^^
94 96
95 97 If you need to manually change some of users details, use the following steps.
96 98
97 99 1. Navigate to your |RCE| install location.
98 100 2. Run the interactive ``ishell`` prompt.
99 101 3. Set a new arguments for users.
100 102
101 103 Use the following code example to carry out these steps.
102 104
103 105 .. code-block:: bash
104 106
105 107 # starts the ishell interactive prompt
106 108 $ rccontrol ishell enterprise-1
107 109
108 110 .. code-block:: mysql
109 111
110 112 # Use this example to change email and username of LDAP user
111 113 In [1]: my_user = User.get_by_username('some_username')
112 114 In [2]: my_user.email = 'new_email@foobar.com'
113 115 In [3]: my_user.username = 'SomeUser'
114 116 In [4]: Session().add(my_user);Session().commit()
115 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