Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bulletin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Personal Projects
bulletin
Commits
0c04baa6
Unverified
Commit
0c04baa6
authored
2 months ago
by
Kevin Lyda
Browse files
Options
Downloads
Patches
Plain Diff
Implement select
parent
48f6e506
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
NOTES.md
+5
-2
5 additions, 2 deletions
NOTES.md
folders/folders.go
+14
-1
14 additions, 1 deletion
folders/folders.go
repl/folders.go
+3
-1
3 additions, 1 deletion
repl/folders.go
with
22 additions
and
4 deletions
NOTES.md
+
5
−
2
View file @
0c04baa6
...
...
@@ -24,8 +24,11 @@ sqlite trigger tracing: `.trace stdout --row --profile --stmt --expanded --plain
## Things to do
*
Implement each command.
*
Next: folder commands - ~~CREATE~~, ~~REMOVE~~, MODIFY, INDEX, SELECT
*
Messages: ADD, CURRENT, DIRECTORY
*
Next: folder commands - ~~CREATE~~, ~~REMOVE~~, MODIFY, ~~INDEX~~, SELECT
*
Messages: ADD, CURRENT, DIRECTORY, BACK, CHANGE, FIRST, REMOVE, NEXT, READ
*
Messages edit: CHANGE, REPLY, FORWARD
*
Moving messages: COPY, MOVE
*
Mail: MAIL, FORWARD,
*
Editor - need an embedded editor
*
An EDT inspired
[
editor
](
https://sourceforge.net/projects/edt-text-editor/
)
*
[
gkilo
](
https://github.com/vcnovaes/gkilo
)
...
...
This diff is collapsed.
Click to expand it.
folders/folders.go
+
14
−
1
View file @
0c04baa6
...
...
@@ -102,19 +102,32 @@ func (s *Store) ListFolder(user string, _ FolderListOptions) ([]FolderListRow, e
return
flr
,
nil
}
// IsFolderAccess checks if a user can access a folder.
func
(
s
*
Store
)
IsFolderAccess
(
name
,
user
string
)
bool
{
found
:=
0
s
.
db
.
Get
(
&
found
,
`SELECT 1 FROM folders AS f LEFT JOIN co_owners AS c ON f.name = c.folder
WHERE f.name = $1 AND
(f.visibility = "public"
OR (f.owner = $2 OR c.OWNER = $2))`
,
name
,
user
)
return
found
==
1
}
// IsFolderOwner checks if a user is a folder owner.
func
(
s
*
Store
)
IsFolderOwner
(
name
,
user
string
)
bool
{
found
:=
0
s
.
db
.
Get
(
&
found
,
`SELECT 1 FROM folders AS f LEFT JOIN co_owners AS c
ON f.name = c.folder
WHERE f.name = $1 (f.owner = '$2' OR c.OWNER = '$2')`
,
WHERE f.name = $1
AND
(f.owner = '$2' OR c.OWNER = '$2')`
,
name
,
user
)
return
found
==
1
}
// DeleteFolder creates a new folder.
func
(
s
*
Store
)
DeleteFolder
(
name
string
)
error
{
// TODO: make sure user can delete this table.
results
,
err
:=
s
.
db
.
Exec
(
"DELETE FROM folders WHERE name=$1"
,
name
)
// TODO: process this error a bit more to give a better error message.
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
repl/folders.go
+
3
−
1
View file @
0c04baa6
...
...
@@ -82,7 +82,9 @@ func ActionCreate(cmd *dclish.Command) error {
// ActionSelect handles the `SELECT` command. This selects a folder.
func
ActionSelect
(
cmd
*
dclish
.
Command
)
error
{
fmt
.
Printf
(
"TODO: implement SELECT:
\n
%s
\n\n
"
,
cmd
.
Description
)
if
accounts
.
User
.
Folders
.
IsFolderAccess
(
cmd
.
Args
[
0
],
accounts
.
User
.
Login
)
{
accounts
.
User
.
CurrentFolder
=
cmd
.
Args
[
0
]
}
return
nil
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment