@@ -59,49 +59,49 @@ public String getDisplayName() {
5959 return "Vigilnz Security Token" ;
6060 }
6161
62- // @POST
63- // public FormValidation doCheckToken(@AncestorInPath Item item, @QueryParameter String token) {
64- // Security: Check if user has permission to configure this item (project/folder)
65- // If item is provided, check item permission; otherwise check global admin permission
66- // if (item != null) {
67- // if (!item.hasPermission(Item.CONFIGURE)) {
68- // return FormValidation.error("No permission to configure this item");
69- // }
70- // } else {
71- // // Global credential creation/editing requires admin permission
72- // Jenkins.get().checkPermission(Jenkins.ADMINISTER);
73- // }
74-
75- // if (token == null || token.trim().isEmpty()) {
76- // return FormValidation.error("Field is required");
77- // }
78- // return FormValidation.ok();
79- // }
80-
81- @ POST
82- public FormValidation doCheckTokenId (@ AncestorInPath Item item , @ QueryParameter String tokenId ) {
83- // Security: Check if user has permission to configure this item (project/folder)
84- // If item is provided, check item permission; otherwise check global admin permission
85- if (item != null ) {
86- if (!item .hasPermission (Item .CONFIGURE )) {
87- return FormValidation .error ("No permission to configure this item" );
88- }
89- } else {
90- // Global credential creation/editing requires admin permission
91- Jenkins .get ().checkPermission (Jenkins .ADMINISTER );
92- }
62+ // @POST
63+ // public FormValidation doCheckToken(@AncestorInPath Item item, @QueryParameter String token) {
64+ // Security: Check if user has permission to configure this item (project/folder)
65+ // If item is provided, check item permission; otherwise check global admin permission
66+ // if (item != null) {
67+ // if (!item.hasPermission(Item.CONFIGURE)) {
68+ // return FormValidation.error("No permission to configure this item");
69+ // }
70+ // } else {
71+ // // Global credential creation/editing requires admin permission
72+ // Jenkins.get().checkPermission(Jenkins.ADMINISTER);
73+ // }
74+ //
75+ // if (token == null || token.trim().isEmpty()) {
76+ // return FormValidation.error("Field is required");
77+ // }
78+ // return FormValidation.ok();
79+ // }
9380
94- if (tokenId != null && !tokenId .trim ().isEmpty ()) {
95- // Check for spaces
96- if (tokenId .contains (" " )) {
97- return FormValidation .error ("ID must not contain spaces." );
98- }
99- // Optional: only allow letters, numbers, dash and underscore
100- if (!tokenId .matches ("^[a-zA-Z0-9_-]+$" )) {
101- return FormValidation .error ("ID can only contain letters, numbers, - and _" );
102- }
103- }
104- return FormValidation .ok ();
105- }
81+ // @POST
82+ // public FormValidation doCheckTokenId(@AncestorInPath Item item, @QueryParameter String tokenId) {
83+ // // Security: Check if user has permission to configure this item (project/folder)
84+ // // If item is provided, check item permission; otherwise check global admin permission
85+ // if (item != null) {
86+ // if (!item.hasPermission(Item.CONFIGURE)) {
87+ // return FormValidation.error("No permission to configure this item");
88+ // }
89+ // } else {
90+ // // Global credential creation/editing requires admin permission
91+ // Jenkins.get().checkPermission(Jenkins.ADMINISTER);
92+ // }
93+ //
94+ // if (tokenId != null && !tokenId.trim().isEmpty()) {
95+ // // Check for spaces
96+ // if (tokenId.contains(" ")) {
97+ // return FormValidation.error("ID must not contain spaces.");
98+ // }
99+ // // Optional: only allow letters, numbers, dash and underscore
100+ // if (!tokenId.matches("^[a-zA-Z0-9_-]+$")) {
101+ // return FormValidation.error("ID can only contain letters, numbers, - and _");
102+ // }
103+ // }
104+ // return FormValidation.ok();
105+ // }
106106 }
107107}
0 commit comments