| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | |
| Eduardo Sousa | d795f87 | 2019-02-05 16:05:53 +0000 | [diff] [blame] | 3 | # Copyright 2018 Whitestack, LLC |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 6 | # not use this file except in compliance with the License. You may obtain |
| 7 | # a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 13 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 14 | # License for the specific language governing permissions and limitations |
| 15 | # under the License. |
| 16 | # |
| 17 | # For those usages not covered by the Apache License, Version 2.0 please |
| 18 | # contact: esousa@whitestack.com or glavado@whitestack.com |
| 19 | ## |
| 20 | |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 21 | """ |
| 22 | Authconn implements an Abstract class for the Auth backend connector |
| 23 | plugins with the definition of the methods to be implemented. |
| 24 | """ |
| 25 | |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 26 | __author__ = ( |
| 27 | "Eduardo Sousa <esousa@whitestack.com>, " |
| 28 | "Pedro de la Cruz Ramos <pdelacruzramos@altran.com>" |
| 29 | ) |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 30 | __date__ = "$27-jul-2018 23:59:59$" |
| 31 | |
| 32 | from http import HTTPStatus |
| tierno | 23acf40 | 2019-08-28 13:36:34 +0000 | [diff] [blame] | 33 | from osm_nbi.base_topic import BaseTopic |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 34 | |
| 35 | |
| 36 | class AuthException(Exception): |
| 37 | """ |
| tierno | c844536 | 2019-06-14 12:07:15 +0000 | [diff] [blame] | 38 | Authentication error, because token, user password not recognized |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 39 | """ |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 40 | |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 41 | def __init__(self, message, http_code=HTTPStatus.UNAUTHORIZED): |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 42 | super(AuthException, self).__init__(message) |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 43 | self.http_code = http_code |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 44 | |
| 45 | |
| tierno | c844536 | 2019-06-14 12:07:15 +0000 | [diff] [blame] | 46 | class AuthExceptionUnauthorized(AuthException): |
| 47 | """ |
| 48 | Authentication error, because not having rights to make this operation |
| 49 | """ |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 50 | |
| tierno | c844536 | 2019-06-14 12:07:15 +0000 | [diff] [blame] | 51 | pass |
| 52 | |
| 53 | |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 54 | class AuthconnException(Exception): |
| 55 | """ |
| 56 | Common and base class Exception for all authconn exceptions. |
| 57 | """ |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 58 | |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 59 | def __init__(self, message, http_code=HTTPStatus.UNAUTHORIZED): |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 60 | super(AuthconnException, self).__init__(message) |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 61 | self.http_code = http_code |
| 62 | |
| 63 | |
| 64 | class AuthconnConnectionException(AuthconnException): |
| 65 | """ |
| 66 | Connectivity error with Auth backend. |
| 67 | """ |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 68 | |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 69 | def __init__(self, message, http_code=HTTPStatus.BAD_GATEWAY): |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 70 | super(AuthconnConnectionException, self).__init__(message, http_code) |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 71 | |
| 72 | |
| 73 | class AuthconnNotSupportedException(AuthconnException): |
| 74 | """ |
| 75 | The request is not supported by the Auth backend. |
| 76 | """ |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 77 | |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 78 | def __init__(self, message, http_code=HTTPStatus.NOT_IMPLEMENTED): |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 79 | super(AuthconnNotSupportedException, self).__init__(message, http_code) |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 80 | |
| 81 | |
| 82 | class AuthconnNotImplementedException(AuthconnException): |
| 83 | """ |
| 84 | The method is not implemented by the Auth backend. |
| 85 | """ |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 86 | |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 87 | def __init__(self, message, http_code=HTTPStatus.NOT_IMPLEMENTED): |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 88 | super(AuthconnNotImplementedException, self).__init__(message, http_code) |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 89 | |
| 90 | |
| 91 | class AuthconnOperationException(AuthconnException): |
| 92 | """ |
| 93 | The operation executed failed. |
| 94 | """ |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 95 | |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 96 | def __init__(self, message, http_code=HTTPStatus.INTERNAL_SERVER_ERROR): |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 97 | super(AuthconnOperationException, self).__init__(message, http_code) |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 98 | |
| 99 | |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 100 | class AuthconnNotFoundException(AuthconnException): |
| 101 | """ |
| 102 | The operation executed failed because element not found. |
| 103 | """ |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 104 | |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 105 | def __init__(self, message, http_code=HTTPStatus.NOT_FOUND): |
| 106 | super().__init__(message, http_code) |
| 107 | |
| 108 | |
| tierno | 1f029d8 | 2019-06-13 22:37:04 +0000 | [diff] [blame] | 109 | class AuthconnConflictException(AuthconnException): |
| 110 | """ |
| 111 | The operation has conflicts. |
| 112 | """ |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 113 | |
| tierno | 1f029d8 | 2019-06-13 22:37:04 +0000 | [diff] [blame] | 114 | def __init__(self, message, http_code=HTTPStatus.CONFLICT): |
| 115 | super().__init__(message, http_code) |
| 116 | |
| 117 | |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 118 | class Authconn: |
| 119 | """ |
| 120 | Abstract base class for all the Auth backend connector plugins. |
| 121 | Each Auth backend connector plugin must be a subclass of |
| 122 | Authconn class. |
| 123 | """ |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 124 | |
| tierno | 9e87a7f | 2020-03-23 09:24:10 +0000 | [diff] [blame] | 125 | def __init__(self, config, db, role_permissions): |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 126 | """ |
| 127 | Constructor of the Authconn class. |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 128 | :param config: configuration dictionary containing all the |
| 129 | necessary configuration parameters. |
| tierno | 9e87a7f | 2020-03-23 09:24:10 +0000 | [diff] [blame] | 130 | :param db: internal database classs |
| 131 | :param role_permissions: read only role permission list |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 132 | """ |
| 133 | self.config = config |
| tierno | 9e87a7f | 2020-03-23 09:24:10 +0000 | [diff] [blame] | 134 | self.role_permissions = role_permissions |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 135 | |
| tierno | 6486f74 | 2020-02-13 16:30:14 +0000 | [diff] [blame] | 136 | def authenticate(self, credentials, token_info=None): |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 137 | """ |
| tierno | 701018c | 2019-06-25 11:13:14 +0000 | [diff] [blame] | 138 | Authenticate a user using username/password or token_info, plus project |
| tierno | 6486f74 | 2020-02-13 16:30:14 +0000 | [diff] [blame] | 139 | :param credentials: dictionary that contains: |
| 140 | username: name, id or None |
| 141 | password: password or None |
| 142 | project_id: name, id, or None. If None first found project will be used to get an scope token |
| 143 | other items are allowed for specific auth backends |
| tierno | 701018c | 2019-06-25 11:13:14 +0000 | [diff] [blame] | 144 | :param token_info: previous token_info to obtain authorization |
| tierno | 38dcfeb | 2019-06-10 16:44:00 +0000 | [diff] [blame] | 145 | :return: the scoped token info or raises an exception. The token is a dictionary with: |
| 146 | _id: token string id, |
| 147 | username: username, |
| 148 | project_id: scoped_token project_id, |
| 149 | project_name: scoped_token project_name, |
| 150 | expires: epoch time when it expires, |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 151 | |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 152 | """ |
| 153 | raise AuthconnNotImplementedException("Should have implemented this") |
| 154 | |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 155 | def validate_token(self, token): |
| 156 | """ |
| 157 | Check if the token is valid. |
| 158 | |
| 159 | :param token: token to validate |
| 160 | :return: dictionary with information associated with the token. If the |
| 161 | token is not valid, returns None. |
| 162 | """ |
| 163 | raise AuthconnNotImplementedException("Should have implemented this") |
| 164 | |
| 165 | def revoke_token(self, token): |
| 166 | """ |
| 167 | Invalidate a token. |
| 168 | |
| 169 | :param token: token to be revoked |
| 170 | """ |
| 171 | raise AuthconnNotImplementedException("Should have implemented this") |
| 172 | |
| delacruzramo | 01b15d3 | 2019-07-02 14:37:47 +0200 | [diff] [blame] | 173 | def create_user(self, user_info): |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 174 | """ |
| 175 | Create a user. |
| 176 | |
| delacruzramo | 01b15d3 | 2019-07-02 14:37:47 +0200 | [diff] [blame] | 177 | :param user_info: full user info. |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 178 | :raises AuthconnOperationException: if user creation failed. |
| 179 | """ |
| 180 | raise AuthconnNotImplementedException("Should have implemented this") |
| 181 | |
| delacruzramo | 01b15d3 | 2019-07-02 14:37:47 +0200 | [diff] [blame] | 182 | def update_user(self, user_info): |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 183 | """ |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 184 | Change the user name and/or password. |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 185 | |
| delacruzramo | 01b15d3 | 2019-07-02 14:37:47 +0200 | [diff] [blame] | 186 | :param user_info: user info modifications |
| 187 | :raises AuthconnNotImplementedException: if function not implemented |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 188 | """ |
| 189 | raise AuthconnNotImplementedException("Should have implemented this") |
| 190 | |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 191 | def delete_user(self, user_id): |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 192 | """ |
| 193 | Delete user. |
| 194 | |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 195 | :param user_id: user identifier. |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 196 | :raises AuthconnOperationException: if user deletion failed. |
| 197 | """ |
| 198 | raise AuthconnNotImplementedException("Should have implemented this") |
| 199 | |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 200 | def get_user_list(self, filter_q=None): |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 201 | """ |
| 202 | Get user list. |
| 203 | |
| tierno | cf042d3 | 2019-06-13 09:06:40 +0000 | [diff] [blame] | 204 | :param filter_q: dictionary to filter user list by name (username is also admited) and/or _id |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 205 | :return: returns a list of users. |
| 206 | """ |
| garciadeblas | f2af4a1 | 2023-01-24 16:56:54 +0100 | [diff] [blame] | 207 | return list() # Default return value so that the method get_user passes pylint |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 208 | |
| tierno | 23acf40 | 2019-08-28 13:36:34 +0000 | [diff] [blame] | 209 | def get_user(self, _id, fail=True): |
| 210 | """ |
| 211 | Get one user |
| 212 | :param _id: id or name |
| 213 | :param fail: True to raise exception on not found. False to return None on not found |
| 214 | :return: dictionary with the user information |
| 215 | """ |
| 216 | filt = {BaseTopic.id_field("users", _id): _id} |
| delacruzramo | 01b15d3 | 2019-07-02 14:37:47 +0200 | [diff] [blame] | 217 | users = self.get_user_list(filt) |
| 218 | if not users: |
| 219 | if fail: |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 220 | raise AuthconnNotFoundException( |
| 221 | "User with {} not found".format(filt), |
| 222 | http_code=HTTPStatus.NOT_FOUND, |
| 223 | ) |
| delacruzramo | 01b15d3 | 2019-07-02 14:37:47 +0200 | [diff] [blame] | 224 | else: |
| 225 | return None |
| 226 | return users[0] |
| 227 | |
| 228 | def create_role(self, role_info): |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 229 | """ |
| 230 | Create a role. |
| 231 | |
| delacruzramo | 01b15d3 | 2019-07-02 14:37:47 +0200 | [diff] [blame] | 232 | :param role_info: full role info. |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 233 | :raises AuthconnOperationException: if role creation failed. |
| 234 | """ |
| 235 | raise AuthconnNotImplementedException("Should have implemented this") |
| 236 | |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 237 | def delete_role(self, role_id): |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 238 | """ |
| 239 | Delete a role. |
| 240 | |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 241 | :param role_id: role identifier. |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 242 | :raises AuthconnOperationException: if user deletion failed. |
| 243 | """ |
| 244 | raise AuthconnNotImplementedException("Should have implemented this") |
| 245 | |
| tierno | 1f029d8 | 2019-06-13 22:37:04 +0000 | [diff] [blame] | 246 | def get_role_list(self, filter_q=None): |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 247 | """ |
| 248 | Get all the roles. |
| 249 | |
| tierno | 1f029d8 | 2019-06-13 22:37:04 +0000 | [diff] [blame] | 250 | :param filter_q: dictionary to filter role list by _id and/or name. |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 251 | :return: list of roles |
| 252 | """ |
| 253 | raise AuthconnNotImplementedException("Should have implemented this") |
| 254 | |
| tierno | 23acf40 | 2019-08-28 13:36:34 +0000 | [diff] [blame] | 255 | def get_role(self, _id, fail=True): |
| 256 | """ |
| 257 | Get one role |
| 258 | :param _id: id or name |
| 259 | :param fail: True to raise exception on not found. False to return None on not found |
| 260 | :return: dictionary with the role information |
| 261 | """ |
| 262 | filt = {BaseTopic.id_field("roles", _id): _id} |
| delacruzramo | 01b15d3 | 2019-07-02 14:37:47 +0200 | [diff] [blame] | 263 | roles = self.get_role_list(filt) |
| 264 | if not roles: |
| 265 | if fail: |
| 266 | raise AuthconnNotFoundException("Role with {} not found".format(filt)) |
| 267 | else: |
| 268 | return None |
| 269 | return roles[0] |
| 270 | |
| 271 | def update_role(self, role_info): |
| tierno | 1f029d8 | 2019-06-13 22:37:04 +0000 | [diff] [blame] | 272 | """ |
| delacruzramo | 01b15d3 | 2019-07-02 14:37:47 +0200 | [diff] [blame] | 273 | Change the information of a role |
| 274 | :param role_info: full role info |
| tierno | 1f029d8 | 2019-06-13 22:37:04 +0000 | [diff] [blame] | 275 | :return: None |
| 276 | """ |
| 277 | raise AuthconnNotImplementedException("Should have implemented this") |
| 278 | |
| delacruzramo | 01b15d3 | 2019-07-02 14:37:47 +0200 | [diff] [blame] | 279 | def create_project(self, project_info): |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 280 | """ |
| 281 | Create a project. |
| 282 | |
| delacruzramo | 01b15d3 | 2019-07-02 14:37:47 +0200 | [diff] [blame] | 283 | :param project_info: full project info. |
| tierno | 4015b47 | 2019-06-10 13:57:29 +0000 | [diff] [blame] | 284 | :return: the internal id of the created project |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 285 | :raises AuthconnOperationException: if project creation failed. |
| 286 | """ |
| 287 | raise AuthconnNotImplementedException("Should have implemented this") |
| 288 | |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 289 | def delete_project(self, project_id): |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 290 | """ |
| 291 | Delete a project. |
| 292 | |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 293 | :param project_id: project identifier. |
| Eduardo Sousa | 819d34c | 2018-07-31 01:20:02 +0100 | [diff] [blame] | 294 | :raises AuthconnOperationException: if project deletion failed. |
| 295 | """ |
| 296 | raise AuthconnNotImplementedException("Should have implemented this") |
| 297 | |
| tierno | 38dcfeb | 2019-06-10 16:44:00 +0000 | [diff] [blame] | 298 | def get_project_list(self, filter_q=None): |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 299 | """ |
| 300 | Get all the projects. |
| 301 | |
| tierno | 38dcfeb | 2019-06-10 16:44:00 +0000 | [diff] [blame] | 302 | :param filter_q: dictionary to filter project list, by "name" and/or "_id" |
| Eduardo Sousa | 5c01e19 | 2019-05-08 02:35:47 +0100 | [diff] [blame] | 303 | :return: list of projects |
| 304 | """ |
| 305 | raise AuthconnNotImplementedException("Should have implemented this") |
| 306 | |
| tierno | 23acf40 | 2019-08-28 13:36:34 +0000 | [diff] [blame] | 307 | def get_project(self, _id, fail=True): |
| 308 | """ |
| 309 | Get one project |
| 310 | :param _id: id or name |
| 311 | :param fail: True to raise exception on not found. False to return None on not found |
| 312 | :return: dictionary with the project information |
| 313 | """ |
| 314 | filt = {BaseTopic.id_field("projects", _id): _id} |
| delacruzramo | 01b15d3 | 2019-07-02 14:37:47 +0200 | [diff] [blame] | 315 | projs = self.get_project_list(filt) |
| 316 | if not projs: |
| 317 | if fail: |
| garciadeblas | 4568a37 | 2021-03-24 09:19:48 +0100 | [diff] [blame] | 318 | raise AuthconnNotFoundException( |
| 319 | "project with {} not found".format(filt) |
| 320 | ) |
| delacruzramo | 01b15d3 | 2019-07-02 14:37:47 +0200 | [diff] [blame] | 321 | else: |
| 322 | return None |
| 323 | return projs[0] |
| 324 | |
| 325 | def update_project(self, project_id, project_info): |
| tierno | 4015b47 | 2019-06-10 13:57:29 +0000 | [diff] [blame] | 326 | """ |
| delacruzramo | 01b15d3 | 2019-07-02 14:37:47 +0200 | [diff] [blame] | 327 | Change the information of a project |
| tierno | 4015b47 | 2019-06-10 13:57:29 +0000 | [diff] [blame] | 328 | :param project_id: project to be changed |
| delacruzramo | 01b15d3 | 2019-07-02 14:37:47 +0200 | [diff] [blame] | 329 | :param project_info: full project info |
| tierno | 4015b47 | 2019-06-10 13:57:29 +0000 | [diff] [blame] | 330 | :return: None |
| 331 | """ |
| 332 | raise AuthconnNotImplementedException("Should have implemented this") |