Skip to content

Commit 3b023b0

Browse files
committed
Add extended help text for chmod, inherit operations
Signed-off-by: Peter Verraedt <peter@verraedt.be>
1 parent 739b34f commit 3b023b0

File tree

1 file changed

+55
-6
lines changed

1 file changed

+55
-6
lines changed

cmd/iron/cli/commands.go

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ When uploading a directory, the target collection must end in a slash to avoid a
396396
If the source directory ends in a slash, files underneath will be placed directly
397397
in the target collection. Otherwise, a subcollection with the same name will be created.`
398398

399-
func (a *App) upload() *cobra.Command {
399+
func (a *App) upload() *cobra.Command { //nolint:funlen
400400
opts := transfer.Options{
401401
SyncModTime: true,
402402
MaxQueued: 10000,
@@ -470,7 +470,7 @@ When downloading a collection, the target folder must end in a slash to avoid am
470470
If the source collection ends in a slash, files underneath will be placed directly
471471
in the target folder. Otherwise, a subfolder with the same name will be created.`
472472

473-
func (a *App) download() *cobra.Command {
473+
func (a *App) download() *cobra.Command { //nolint:funlen
474474
opts := transfer.Options{
475475
SyncModTime: true,
476476
MaxQueued: 10000,
@@ -675,12 +675,45 @@ func (a *App) save() *cobra.Command {
675675
return cmd
676676
}
677677

678+
var chmodDescription = `Modify access to data objects and collections.
679+
680+
By default, the original creator of a data object has 'own' permission.
681+
682+
The iRODS Permission Model is linear with 10 levels.
683+
Access levels can be specified both to data objects and collections.
684+
A granted access level also includes access to all lower levels.
685+
686+
'own'
687+
'delete_object'
688+
'modify_object' (= 'write')
689+
'create_object'
690+
'delete_metadata'
691+
'modify_metadata'
692+
'create_metadata'
693+
'read_object' (= 'read')
694+
'read_metadata'
695+
'null'
696+
697+
The iRODS Permission Model allows for multiple ownership.
698+
Granting 'own' to another user or group will allow them to grant
699+
permission to and revoke permission from others (including you).
700+
701+
Setting the access level to 'null' will remove access for that user or group.
702+
703+
Example Operations requiring permissions:
704+
705+
irm - requires 'delete_object' or greater
706+
imv - requires 'delete_object' or greater, due to removal of old name
707+
iput - requires 'modify_object' or greater
708+
iget - requires 'read_object' or greater`
709+
678710
func (a *App) chmod() *cobra.Command {
679711
var recursive bool
680712

681713
cmd := &cobra.Command{
682-
Use: "chmod <permission> <user> <path>",
714+
Use: "chmod <access level> <user or group> <path>",
683715
Short: "Change permissions",
716+
Long: chmodDescription,
684717
Args: cobra.ExactArgs(3),
685718
RunE: func(cmd *cobra.Command, args []string) error {
686719
return a.ModifyAccess(cmd.Context(), a.Path(args[2]), args[1], args[0], recursive)
@@ -692,13 +725,29 @@ func (a *App) chmod() *cobra.Command {
692725
return cmd
693726
}
694727

728+
const inheritDescription = `Change permission inheritance for a collection.
729+
730+
The inherit/noinherit form sets or clears the inheritance attribute of
731+
a collection. When collections have this attribute set,
732+
new data objects and subcollections added to the collection inherit the
733+
access permissions (ACLs) of the collection.
734+
735+
The inherit status is shown by the + symbol when listing collections.`
736+
695737
func (a *App) inherit() *cobra.Command {
696738
var recursive, inherit bool
697739

740+
examples := []string{
741+
" Enable inheritance for a collection:\n\t" + a.name + " inherit collection",
742+
" Disable inheritance for a collection:\n\t" + a.name + " inherit --enable=false collection",
743+
}
744+
698745
cmd := &cobra.Command{
699-
Use: "inherit <collection path>",
700-
Short: "Change permission inheritance",
701-
Args: cobra.ExactArgs(1),
746+
Use: "inherit <collection path>",
747+
Short: "Change permission inheritance",
748+
Long: inheritDescription,
749+
Example: strings.Join(examples, "\n"),
750+
Args: cobra.ExactArgs(1),
702751
RunE: func(cmd *cobra.Command, args []string) error {
703752
return a.SetCollectionInheritance(cmd.Context(), a.Path(args[0]), inherit, recursive)
704753
},

0 commit comments

Comments
 (0)