Skip to content

Commit

Permalink
Merge pull request #559 from chhsiao1981/user-perm-info-guest
Browse files Browse the repository at this point in the history
UserPermInfo for guest
  • Loading branch information
chhsiao1981 authored Oct 2, 2024
2 parents 07d3d82 + 5ee02b6 commit 448ed9c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19-bullseye
FROM golang:1.22-bullseye

ENV GOROOT=/usr/local/go
ENV PATH=${PATH}:/usr/local/go/bin
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/Ptt-official-app/go-pttbbsweb

go 1.21

toolchain go1.22.2
go 1.22

require (
github.com/Ptt-official-app/go-pttbbs v0.24.2
Expand Down
10 changes: 10 additions & 0 deletions schema/user_perm_info.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package schema

import (
pttbbsapi "github.com/Ptt-official-app/go-pttbbs/api"
"github.com/Ptt-official-app/go-pttbbs/bbs"
"github.com/Ptt-official-app/go-pttbbs/ptttype"
"github.com/Ptt-official-app/go-pttbbsweb/types"
Expand Down Expand Up @@ -29,6 +30,15 @@ var (
)

func GetUserPermInfo(userID bbs.UUserID) (userPermInfo *UserPermInfo, err error) {
// XXX for guest
if userID == bbs.UUserID(pttbbsapi.GUEST) {
return &UserPermInfo{
UserID: userID,

Over18: true,
}, nil
}

query := bson.M{
USER_USER_ID_b: userID,
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/docker_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
branch=`git branch|grep '^*'|sed 's/^\* //g'|sed -E 's/^\(HEAD detached at //g'|sed -E 's/\)$//g'`
project=`basename \`pwd\``

GO_PTTBBS_VERSION=`grep go-pttbbs go.mod|awk '{print $2}'`
GO_PTTBBS_VERSION=`grep "go-pttbbs v" go.mod|awk '{print $2}'`
echo "GO_PTTBBS_VERSION: ${GO_PTTBBS_VERSION}"

docker build -t ${project}:${branch} -f docker/Dockerfile --build-arg GO_PTTBBS_VERSION=${GO_PTTBBS_VERSION} .

0 comments on commit 448ed9c

Please sign in to comment.