summaryrefslogtreecommitdiffstats
path: root/ogcp/forms
Commit message (Collapse)AuthorAgeFilesLines
* ogcp: add user permission mechanismAlejandro Sirgo Rica2024-06-271-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new user permission system to control the allowed operations accessible from each account. Add a permission matrix editable through the user/add and user/edit views. The permission matrix has client, center, room, folder, image and repository as permission targets and add, update and delete as permission types. Restrict each view based on the user permissions, hide all actions from not autheticated users. permissions defined in the class UserForm. Serialize each user permissions into ogcp.json as: { ... "USERS" [ { "USER": "admin" ... "PERMISSIONS": { "CLIENT": { "ADD": true, "UPDATE": true, "DELETE": true, }, ... <- same structure for "CENTER", "ROOM", "FOLDER", "IMAGE" and "REPOSITORY" } }, ... ], ... } Grant all the permissions to old user configuration to not disrupt their workflow. The administrator will need to assign the permissions for each user. Ignore scope and permission restrictions for admin users. Save permissions and scopes even if the user is admin to account for the case of a temporal admin promotion without losing the previous configuration. Use template inheritance for add_user.html and edit_user.html to prevent big code duplication with the new HTML code to render the permission matrix. Make user administration an admin only feature. Define methods get_permission and target_is_disabled to improve readability in template conditionals that disable features based on user permissions.
* ogcp: add support to run scripts in clientsAlejandro Sirgo Rica2024-06-251-0/+9
| | | | | | | | Add view at /action/script/run to visualize the available scripts and run a single script file in the selected clients. Use shell/list to request the script list and shell/run API call to request the execution.
* views: make password optional in user/editAlejandro Sirgo Rica2024-06-191-1/+8
| | | | | | | | | Add the option to leave the password fields empty in the form. When the passwords are not set the user keeps the old password configuration. Define a EditUserForm based on UserForm in forms/auth.py to remove the InputRequired validator in the password fields. Update the html template to make the password fields optional.
* ogcp: add move client to scopes managementAlejandro Sirgo Rica2024-06-171-0/+5
| | | | | | | | | | Add front end for the client/move REST API. Enable the move of multiple clients selected from the sidebar of Scopes Management. Show the target of the move operation as a list of paths in a dropdown widget in the form. Each path will be structured as: Server/Center/Room The path will also contain folders if they are present.
* forms: improve scopes field description in UserFormAlejandro Sirgo Rica2024-06-141-1/+1
| | | | | Improve the information provided to the user related to scope selection.
* forms: use checkboxes for scope selection in UserFormAlejandro Sirgo Rica2024-06-141-1/+3
| | | | | | | Enable selection of multiple scopes in user/add and user/edit for restricted users. Replace quick form creation with an inline form definition in add_user.html and edit_user.html
* forms: disable validation for dynamically populated select fieldsAlejandro Sirgo Rica2024-06-071-3/+3
| | | | | | | Disable form validation for dynamically populated select fields, otherwise, user hits bogus errors. This problem was introduced by COMMIT 43e3346.
* forms: add support for UNICAST image restoreAlejandro Sirgo Rica2024-06-051-1/+3
| | | | | | | | | | Add UNICAST and UNICAST-DIRECT to the image restore form. UNICAST-DIRECT will transfer the images through a samba share and proceed with the restore process without using any cache partition. UNICAST will try to first copy the image to the cache partition and generate the full.sum file. Then the restore process is executed.
* forms: set default values to partition and formatAlejandro Sirgo Rica2024-06-041-3/+6
| | | | | | | | Add default values to the partition and format form component. Prevent index None from showing in the form when the client has an empty disk with no partitions. Now the form will be created with an entry of index 1 in adition to Type and Filesystem as Empty in that case.
* forms: ensure ip and mac are not empty in client add formAlejandro Sirgo Rica2024-06-031-2/+4
| | | | | | Use the WTForms validator InputRequired to check the field and disable the submit button if either the IP or MAC fields have no contents.
* ogcp: add cache management pageAlejandro Sirgo Rica2024-05-301-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement cache management through cache/list and cache/delete API REST methods. The view corresponds to the URL action/cache and contains three main parts: - Free cache available in the client's bubbles. - Image selection form to request the deletion and view the client with that image in cache. - Cache details per client to see total, used and available cache. The main usecase for the view is the removal of cache to make room for new images in clients with slow connections. Checking clients where available cache space is not enough to hold the new image and then requesting removal of specific images. The html template receives the following structures from the view: storage_data[ip] = {'used': 223452345, 'total': 2345234523452} client_images[ip] = [f'{image_name}.{image_checksum}', ...] image_data[f'{image_name}.{image_checksum}'] = { clients: ['192.168.0.1', ...], size: 34534530850, name: image_name, }
* make the boot OS form work over multiple clientsAlejandro Sirgo Rica2024-05-161-1/+0
| | | | | | | | | Enable working over multiple clients even if their OS configuration is different to greatly improve the user's workflow. Group clients with the same configuration under the same checkbox in the form. Report clients excluded from the boot instruction due to not matching OS configuration.
* remove Format field from partition setup formAlejandro Sirgo Rica2024-05-131-1/+0
| | | | | | | Remove the 'Format' field from the Partition and Format form as the default value will always be to format the partitions. This will lead to less portantial codepaths to maintain and support and less manual clicks in the web form.
* Make partition id non editable in partition formAlejandro Sirgo Rica2024-05-121-2/+2
| | | | | | | Show the partition id as a non editable label in each partition of the Partition and Format form. Assign sequential partition id from top to down and recalculate every partition id when a partition is removed.
* forms: remove EXFATOpenGnSys Support Team2024-05-071-1/+0
| | | | ogclient does not support this filesystem type, remove it.
* views: add update centerJavier Hernandez2024-02-091-0/+1
| | | | add view to update center data such as its name or comment.
* views: Add update roomJavier Hernandez2024-02-091-0/+1
| | | | Add view to modify room information such as name, gateway and netmask
* improve delete confirmationJavier Hernandez2024-02-051-4/+2
| | | | | | | | Make delete confirmations show information in a manner that is easier to read. This includes delete confirmations for centers, room and folder. Messages are now more clear. Also, content table shows the type of the items (folder, room, etc.)
* forms: Remove netiface from client's formJavier Hernandez2024-01-151-4/+0
| | | | | | | | | | Remove netiface selectable in clientsDetails form. eth{0,1,2} is misleading, it does not represent the real device in the client. And users we know always boot from the first device. Hide this feature until there is a better design for this.
* views: add room to folderJavier Hernandez2024-01-111-0/+1
| | | | Support adding a room to a folder
* views: Add computers to folderJavier Hernandez2024-01-111-0/+1
| | | | | | | | | | Add support for adding computers to a folder. It uses a js script that when selecting a folder in the html form, it will also select the parent of the folder. For instance, if the user were to select a folder that is contained inside a room, the room would also get selected. This allows the view to know which parent contains the folder.
* views: Add delete folderJavier Hernandez2024-01-101-0/+1
| | | | | | | Add functionality to allow the user to delete a folder. Show a confirmation page to the user listing the content of the folder that is about to delete
* src: Add support for adding foldersJavier Hernandez2024-01-101-0/+7
| | | | | | Add support to create a folder able to contain multiple computers. Add support for adding a folder able to contain rooms
* templates: rename 'create' button to 'submit'Javier Hernandez2023-12-211-1/+1
| | | | | | | In client_details template, rename 'create' button to 'submit'. This template is used by both client-add and client-edit commands; it would not make sense to have a 'Create' button in client-edit.
* views: add select repo in import clientsJavier Hernandez2023-12-131-0/+1
| | | | | | | | Add, in import clients menu, a selector to select the repo to be associated with the clients about to import modify OG_CLIENT_DEFAULT_BOOT variable to be 'oglive'; 'pxe' is not a valid boot mode, and ogserver would return an error
* views: Add 'description' field to image detailsJavier Hernandez2023-12-121-0/+1
| | | | Add a 'description' field to the image-details form.
* Change Image-details' 'Datasize' unit to MiBJavier Hernandez2023-12-121-1/+1
| | | | | Change the Image details form to display the 'Datasize' field of the image in MiB instead of GiB
* views: add action to delete repoJavier Hernandez2023-12-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | allow the user to delete a repo by selecting one and pressing the delete button. Previous to deletion, show the user a confirmation page (a form) with the details of the repo to delete the confirmation form is constructed with the fields of Repoform. RepoForm is also used in template used to create a repo. To make both templates work with RepoForm, RepoForm's field 'create' has been renamed to 'submit' ogcp.js: add a function to make that, when the user selects a repository, the server in which it is contained is automatically checked. We need it checked so that action_repo_delete can know the server to which it has to send the delete request. Use data-server in repos_details.html to make this work Validate, in action_delete_repo, that user has only selected one repo to delete. In order to do that, action_delete_repo view needs to be able to get a list of all selected repos. This is only possible if <input> elements that are associated with repos info contain a different name attribute per repo. In this case, template repos.html has been modified to use name={repo name}-{repo_id}. After this, parse_elements() will work and parse a set containing all selected repos. modify html input associated to repos server in order to follow same convention as in other templates. For example, images uses image-server; scopes, scope-server.
* src: add menu to manage reposJavier Hernandez2023-12-011-0/+6
| | | | | | | | | | | | | | | | | | | | | | | The menu includes a list of the repos of each server. The user can select a server or a repo to make changes. As of now, the only action possible is to add a repo to selected server. The work contained in this commit can be structured in: 1. Add the repos menu: - Add a 'repos' button in the menus bar (base.html). - Add repos.html template to create the management repos menu. - In ogcp.js, add function to store in browser's local storage which elements of the sidebar are uncollapsed. This saves the sidebar state after a page refresh. - Add manage_repos() in views.py 2. Allow to add a repo: - Add template with form to add a repo (repos_details.html) - Create RepoForm(FlaskForm) in action_forms.py - Add repo_add_get() and repo_add_post() in views.py
* views: populate repositories in client formJavier Hernandez2023-11-291-2/+1
| | | | | Make, in add and edit clients forms, the field repository show the list with the actual repositories, not a harcoded value.
* image: rename and remove fieldsv1.1.3-4Javier Hernandez2023-11-271-3/+2
| | | | | | - remove field image 'id' - change size to display MiB instead of GiB - replace 'Modified' with 'Last update'
* client: Remove 'netmask' in formJavier Hernandez2023-11-271-1/+0
| | | | | Remove unnecessary field 'netmask' from forms used to create and update clients. Netmask is configured in rooms instead.
* src: Remove netdriver field in client formJavier Hernandez2023-11-231-2/+0
| | | | | | | | Remove netdriver field from forms used to add or update a client. At the time of creating (or updating) a client, ogCP uses a hardcoded value for this field of the payload. This field is not used by oglive in any way, remove it.
* views: add field 'gateway' in add-room formJavier Hernandez2023-11-141-0/+2
| | | | Add the possibility to configure a gateway in a room.
* ogcp: add backup boolean field in image updatev1.1.3Jose M. Guisado2023-07-071-0/+1
| | | | | | | | User can use this boolean field to specify if an backup copy needs to be created before updating an image. This only applies when sending a request to a client (ogClient) supporting this parameter.
* Add Servers sectionJavier Sánchez Parra2022-09-271-1/+5
| | | | | | | In Servers section/view, users can add or delete ogServers from ogCP configuration file. Replaces Repositories views and recycle some of its code.
* Adapt Delete image to work with several ogServersJavier Sánchez Parra2022-09-271-0/+1
| | | | | This commit makes Delete image view to use ogServer field from imagesForm to send the deletion request to the correct ogServer.
* Adapt Delete center to work with several ogServersJavier Sánchez Parra2022-09-271-0/+1
| | | | | This commit makes Delete center view to use ogServer field from scopesForm to send the command to the correct ogServer.
* Adapt Add center to work with several ogServersJavier Sánchez Parra2022-09-271-0/+2
| | | | | | This commit adds a new select input with all available ogServers to "Add center" view. The ogCP creates the center in the ogServer selected by the user.
* Adapt Delete room to work with several ogServersJavier Sánchez Parra2022-09-271-0/+1
| | | | | This commit makes Delete room view to use ogServer field from scopesForm to send the command to the correct ogServer.
* Adapt Add room to work with several ogServersJavier Sánchez Parra2022-09-271-0/+1
| | | | | This commit makes Add room view to use ogServer field from scopesForm to send the command to the correct ogServer.
* Adapt Import Clients to work with several ogServersJavier Sánchez Parra2022-09-271-0/+1
| | | | | This commit makes Import Clients view to use ogServer field from scopesForm to send the command to the correct ogServer.
* Add current ogServer to scopesFormJavier Sánchez Parra2022-09-271-0/+1
| | | | | | | | | With this commit when users select a scope, the ogServer to which it belongs is also sent. Then when processing the form we obtain this ogServer and we can send it the pertinent requests. This commit also makes action "Add client" to use the ogServer sent in the form.
* Add "Delete Repository"Javier Sánchez Parra2022-07-041-0/+5
| | | | | In "Repositories" view, users select a repository from the list on the left and press "Delete repository".
* Create "Add Repository" form and viewJavier Sánchez Parra2022-07-041-0/+7
| | | | Creates "Add repository" form with the required inputs: name and IP.
* Move password hashing to the backendJavier Sánchez Parra2022-06-301-8/+2
| | | | | | | | | | | This patch moves login password hashing from the frontend/javascript to the backend/flask. This patch moves password hashing of login and user management forms. Related commits: * c7b0024 ("Add password hashing") * 661254b ("Add 'Add user' to Users section")
* Rename field "OS" from "Create image"Javier Sánchez Parra2022-06-071-1/+1
| | | | | | Rename "OS" to "Partition" to improve clarity. This field represent which partition is used to create the image.
* Add repository field to "Create image" formJavier Sánchez Parra2022-05-241-0/+2
| | | | Let users choose which repository want to use to save the image.
* Add 'Delete user' to Users sectionv0.9.2Javier Sánchez Parra2022-04-271-0/+9
| | | | | Creates "Delete user" form. The user to be deleted is selected from the sidebar in Users section.
* Add 'Add user' to Users sectionJavier Sánchez Parra2022-04-271-1/+30
| | | | | Creates "Add user" form with the following inputs: username, password, password confirmation, role (administrator or regular), allowed scopes.